You need to create an account with CometChat to use the components.Also, ensure initializing CometChatUIKit first and logging in correctly before trying to render any component from the UI Kit package.Please make sure you have followed our Integration guidelines.
Without further ado, let’s get into how we can build this thing.
First, lets create a Activity, lets call it CometChatUiActivity and add the following code into the xml file of the activity
Now lets create menu that need to be shown on a Bottom navigation view. To create a Menu, first, create a Menu Directoryby clicking on the_app->_ res(right-click) ->_ New->Android Resource Directoryand selectMenuin theResource Type._
To create a Menu Resource File , click on the app -> res -> menu(right-click) -> New -> Menu Resource File and name it bottom_nav_menu_item.
Now create 4 Fragments and load CometChatConversationsWithMessages, CometChatUsersWithMessages, CometChatGroupsWithMessagesand CometChatCallHistoryWithDetails individually in each of them.ConversationsWithMessagesFragment.java
Copy
Ask AI
public class ConversationsWithMessagesFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_conversation_with_messages, container, false); }}
public class UsersWithMessagesFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_users_with_messages, container, false); }}
public class GroupsWithMessagesFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_groups_with_messages, container, false); }}