Modifying UI

We now provide you along with the CometChat SDK, the source code for our UI. This source code can be found in the downloaded package under the Android/CometChat UI Source folder in the downloaded package. This folder contains the source code for the UI.

Like mentioned in the previous sections, you are provided with the option to directly launch the existing UI that comes with the SDK. But now you can also modify the UI to suit your requirements. Feel free to dive into the codebase and play around with it. This will help you to get a clear understanding of how the application works and also in the process help you achieve the UI of your choice.

Steps to modify the UI:

  1. Please import the Android project found under `Android/CometChat UI Source` in the downloaded package into Android Studio.
  2. Make the necessary changes in the CCUrlInitializerActivity.java. Here you will need to change the siteURL, License key, Apikey and the isCometOnDemand parameter based on your subscription. You can find more information regarding the parameters [here](https://docs.cometchat.com/android-sdk/initialization/).
  3. Run the app. Enter valid user credentials to log in to the chat.
  4. Go through the code and understand the codebase. Make the necessary changes to the UI as per your requirement.
  5. Open the gradle section in Android studio. In the CometChatUI folder under the Tasks/build section, double click the assemblerelease option.
  6. This will generate the CometChatUI.aar in the CometChatUI/CometChatUI/build/outputs/aar/CometChatUI-release.aar.
  7. Add this file to your Android project and sync gradle. Run the project and the UI changes should be reflected in your app.

You can add the CometChat.aar as a gradle dependency or a modular dependency.

  • Was this helpful?
  • Yes   No