Skip to main content
CometChatCallLogs renders a scrollable list of call logs for the logged-in user with caller names, avatars, call status indicators, and timestamps.

Where It Fits

CometChatCallLogs is a list component. It renders the user’s call history and emits the selected CallLog via onItemClick. Use it as a standalone call history screen or as a tab in a tabbed layout alongside conversations and contacts.
activity_call_logs.xml
<com.cometchat.uikit.kotlin.presentation.calllogs.ui.CometChatCallLogs
    android:id="@+id/call_logs"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
val callLogs = findViewById<CometChatCallLogs>(R.id.call_logs)

callLogs.setOnItemClick { callLog ->
    // Navigate to call detail or initiate call
}

Quick Start

Add to your layout XML:
<com.cometchat.uikit.kotlin.presentation.calllogs.ui.CometChatCallLogs
    android:id="@+id/call_logs"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
Or programmatically:
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(CometChatCallLogs(this))
}
Prerequisites: CometChat SDK initialized with CometChatUIKit.init(), a user logged in, the UI Kit dependency added, and the CometChat Calls SDK configured. Or in a Fragment:
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
    return CometChatCallLogs(requireContext())
}

Filtering Call Logs

Pass a CallLogRequest.CallLogRequestBuilder to control what loads:
callLogs.setCallLogRequestBuilder(
    CallLogRequest.CallLogRequestBuilder()
        .setLimit(20)
        .setCallCategory(CometChatConstants.CALL_CATEGORY_CALL)
)

Filter Recipes

RecipeBuilder method
Limit per page.setLimit(10)
Audio calls only.setCallType(CometChatConstants.CALL_TYPE_AUDIO)
Video calls only.setCallType(CometChatConstants.CALL_TYPE_VIDEO)
Call category.setCallCategory(CometChatConstants.CALL_CATEGORY_CALL)
Pass the builder object, not the result of .build(). The component calls .build() internally. Default page size is 30 with infinite scroll.

Actions and Events

Callback Methods

onItemClick

Fires when a call log row is tapped. Primary navigation hook.
callLogs.setOnItemClick { callLog ->
    // Navigate to call detail
}
Replaces the default item-click behavior. Your custom lambda executes instead of the built-in navigation.

onItemLongClick

Fires when a call log row is long-pressed.
callLogs.setOnItemLongClick { callLog ->
    // Show context menu
}

onBackPress

Fires when the user presses the back button in the toolbar.
callLogs.setOnBackPress {
    finish()
}

onError

Fires on internal errors (network failure, auth issue, SDK exception).
callLogs.setOnError { exception ->
    Log.e("CallLogs", "Error: ${exception.message}")
}

onLoad

Fires when the list is successfully fetched and loaded.
callLogs.setOnLoad { callLogList ->
    Log.d("CallLogs", "Loaded ${callLogList.size}")
}

onEmpty

Fires when the list is empty after loading.
callLogs.setOnEmpty {
    Log.d("CallLogs", "No call logs")
}

Functionality

Method (Kotlin XML)Compose ParameterDescription
setBackIconVisibility(View.VISIBLE)hideBackIcon = falseToggle back button
setToolbarVisibility(View.GONE)hideToolbar = trueToggle toolbar
setSeparatorVisibility(View.GONE)hideSeparator = trueToggle list separators
setTitle("Call History")title = "Call History"Custom toolbar title

Custom View Slots

Leading View

Replace the avatar / left section.
callLogs.setLeadingView(object : CallLogsViewHolderListener() {
    override fun createView(context: Context, binding: CometchatListBaseItemsBinding): View {
        return ImageView(context).apply {
            layoutParams = ViewGroup.LayoutParams(48.dp, 48.dp)
        }
    }

    override fun bindView(
        context: Context, createdView: View, callLog: CallLog,
        holder: RecyclerView.ViewHolder, callLogList: List<CallLog>, position: Int
    ) {
        val imageView = createdView as ImageView
        // Load caller avatar
    }
})

Title View

Replace the name / title text.
callLogs.setTitleView(object : CallLogsViewHolderListener() {
    override fun createView(context: Context, binding: CometchatListBaseItemsBinding): View {
        return TextView(context)
    }

    override fun bindView(
        context: Context, createdView: View, callLog: CallLog,
        holder: RecyclerView.ViewHolder, callLogList: List<CallLog>, position: Int
    ) {
        (createdView as TextView).text = callLog.initiator?.name ?: ""
    }
})

Subtitle View

Replace the subtitle text below the caller’s name.
callLogs.setSubtitleView(object : CallLogsViewHolderListener() {
    override fun createView(context: Context, binding: CometchatListBaseItemsBinding): View {
        return TextView(context).apply { maxLines = 1; ellipsize = TextUtils.TruncateAt.END }
    }

    override fun bindView(
        context: Context, createdView: View, callLog: CallLog,
        holder: RecyclerView.ViewHolder, callLogList: List<CallLog>, position: Int
    ) {
        (createdView as TextView).text = callLog.status ?: "Unknown"
    }
})

Trailing View

Replace the right section of each call log item.
callLogs.setTrailingView(object : CallLogsViewHolderListener() {
    override fun createView(context: Context, binding: CometchatListBaseItemsBinding): View {
        return TextView(context)
    }

    override fun bindView(
        context: Context, createdView: View, callLog: CallLog,
        holder: RecyclerView.ViewHolder, callLogList: List<CallLog>, position: Int
    ) {
        (createdView as TextView).text = SimpleDateFormat("h:mm a", Locale.getDefault())
            .format(Date(callLog.initiatedAt * 1000))
    }
})

Item View

Replace the entire list item row.
callLogs.setItemView(object : CallLogsViewHolderListener() {
    override fun createView(context: Context, binding: CometchatListBaseItemsBinding): View {
        return LayoutInflater.from(context).inflate(R.layout.custom_call_log_item, null)
    }

    override fun bindView(
        context: Context, createdView: View, callLog: CallLog,
        holder: RecyclerView.ViewHolder, callLogList: List<CallLog>, position: Int
    ) {
        val avatar = createdView.findViewById<CometChatAvatar>(R.id.custom_avatar)
        val title = createdView.findViewById<TextView>(R.id.tvName)
        title.text = callLog.initiator?.name
        avatar.setAvatar(callLog.initiator?.name, callLog.initiator?.avatar)
    }
})

State Views

callLogs.setEmptyView(R.layout.custom_empty_view)
callLogs.setErrorView(R.layout.custom_error_view)
callLogs.setLoadingView(R.layout.custom_loading_view)

Overflow Menu

callLogs.setOverflowMenu(ImageButton(context).apply {
    setImageResource(R.drawable.ic_filter)
    setOnClickListener { /* show filter */ }
})

// Replace all options
callLogs.setOptions { context, callLog ->
    listOf(
        CometChatPopupMenu.MenuItem(id = "delete", name = "Delete", onClick = { /* ... */ }),
        CometChatPopupMenu.MenuItem(id = "callback", name = "Call Back", onClick = { /* ... */ })
    )
}

// Append to defaults
callLogs.setAddOptions { context, callLog ->
    listOf(
        CometChatPopupMenu.MenuItem(id = "info", name = "Info", onClick = { /* ... */ })
    )
}

Common Patterns

Minimal list — hide all chrome

callLogs.setToolbarVisibility(View.GONE)
callLogs.setSeparatorVisibility(View.GONE)

Audio calls only

callLogs.setCallLogRequestBuilder(
    CallLogRequest.CallLogRequestBuilder()
        .setCallType(CometChatConstants.CALL_TYPE_AUDIO)
)

Video calls only

callLogs.setCallLogRequestBuilder(
    CallLogRequest.CallLogRequestBuilder()
        .setCallType(CometChatConstants.CALL_TYPE_VIDEO)
)

Advanced Methods

ViewModel Access

val factory = CometChatCallLogsViewModelFactory()
val viewModel = ViewModelProvider(this, factory)
    .get(CometChatCallLogsViewModel::class.java)
callLogs.setViewModel(viewModel)
See ViewModel & Data for ListOperations, state observation, and custom repositories.

Style

Define a custom style in themes.xml:
themes.xml
<style name="CustomCallLogsAvatarStyle" parent="CometChatAvatarStyle">
    <item name="cometchatAvatarStrokeRadius">8dp</item>
    <item name="cometchatAvatarBackgroundColor">#FBAA75</item>
</style>

<style name="CustomCallLogsStyle" parent="CometChatCallLogsStyle">
    <item name="cometchatCallLogsAvatarStyle">@style/CustomCallLogsAvatarStyle</item>
    <item name="cometchatCallLogsSeparatorColor">#F76808</item>
    <item name="cometchatCallLogsTitleTextColor">#F76808</item>
</style>

<style name="AppTheme" parent="CometChatTheme.DayNight">
    <item name="cometchatCallLogsStyle">@style/CustomCallLogsStyle</item>
</style>

Style Properties

PropertyDescription
backgroundColorList background color
titleTextColorToolbar title color
itemStyle.backgroundColorRow background
itemStyle.titleTextColorCaller name color
itemStyle.subtitleTextColorCall status text color
itemStyle.separatorColorRow separator color
itemStyle.avatarStyleAvatar appearance
See Component Styling for the full reference.

Next Steps

Call Features

Voice and video calling overview

Conversations

Browse recent conversations

Component Styling

Detailed styling reference with screenshots

ViewModel & Data

Custom ViewModels, repositories, and ListOperations