Search in sources :

Example 1 with GroupsRequest

use of com.cometchat.pro.core.GroupsRequest in project android-java-chat-push-notification-app by cometchat-pro.

the class CometChatGroupList method searchGroup.

/**
 *  This method is used to search groups present in your App_ID.
 *  For more detail please visit our official documentation {@link "https://prodocs.cometchat.com/docs/android-groups-retrieve-groups" }
 *
 * @param s is a string used to get groups matches with this string.
 * @see GroupsRequest
 */
private void searchGroup(String s) {
    GroupsRequest groupsRequest = new GroupsRequest.GroupsRequestBuilder().setSearchKeyWord(s).setLimit(100).build();
    groupsRequest.fetchNext(new CometChat.CallbackListener<List<Group>>() {

        @Override
        public void onSuccess(List<Group> groups) {
            // sets the groups in rvGroupList i.e CometChatGroupList Component.
            rvGroupList.searchGroupList(groups);
        }

        @Override
        public void onError(CometChatException e) {
            Toast.makeText(getContext(), CometChatError.localized(e), Toast.LENGTH_SHORT).show();
        }
    });
}
Also used : GroupsRequest(com.cometchat.pro.core.GroupsRequest) CometChatException(com.cometchat.pro.exceptions.CometChatException) Group(com.cometchat.pro.models.Group) ViewGroup(android.view.ViewGroup) CometChat(com.cometchat.pro.core.CometChat) ArrayList(java.util.ArrayList) ColorStateList(android.content.res.ColorStateList) List(java.util.List)

Aggregations

ColorStateList (android.content.res.ColorStateList)1 ViewGroup (android.view.ViewGroup)1 CometChat (com.cometchat.pro.core.CometChat)1 GroupsRequest (com.cometchat.pro.core.GroupsRequest)1 CometChatException (com.cometchat.pro.exceptions.CometChatException)1 Group (com.cometchat.pro.models.Group)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1