Created
January 27, 2022 16:27
-
-
Save warodri-sendbird/7b55796e301d54ed7e24c3960c43c6f5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.uikitinsidefragment; | |
import androidx.appcompat.app.AppCompatActivity; | |
import androidx.fragment.app.FragmentManager; | |
import android.os.Bundle; | |
import com.sendbird.android.GroupChannel; | |
import com.sendbird.android.GroupChannelListQuery; | |
import com.sendbird.uikit.fragments.ChannelListFragment; | |
public class UIKitActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_uikit); | |
invokeUIKit(); | |
} | |
/** | |
* Show UIKit fragment | |
*/ | |
private void invokeUIKit() { | |
ChannelListFragment fragment = createChannelListFragment(); | |
FragmentManager manager = getSupportFragmentManager(); | |
manager.popBackStack(); | |
manager.beginTransaction() | |
.replace(R.id.fragmentContainer, fragment) | |
.commit(); | |
} | |
protected ChannelListFragment createChannelListFragment() { | |
// Your query here | |
GroupChannelListQuery query = GroupChannel.createMyGroupChannelListQuery(); | |
query.setIncludeEmpty(true); | |
// Return | |
return new ChannelListFragment.Builder() | |
.setUseHeader(true) | |
.setGroupChannelListQuery(query) | |
.build(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment