- 代码1:
- List<Conversation.ConversationType> types = Arrays.asList(Conversation.ConversationType.Single,Conversation.ConversationType.Group);
- List<Integer> lines = Arrays.asList(0);
- ConversationListViewModel conversationListViewModel = new ViewModelProvider((ViewModelStoreOwner) this, new ConversationListViewModelFactory(types, lines))
- .get(ConversationListViewModel.class);
- conversationListViewModel.conversationListLiveData().observe((LifecycleOwner) this, conversationInfos -> {
-
- });
-
- 代码2:
- List<Conversation.ConversationType> types = Arrays.asList(Conversation.ConversationType.Single,Conversation.ConversationType.Group);
- List<Integer> lines = Arrays.asList(0);
- ChatManager.Instance().getWorkHandler().post(new Runnable() {
- @Override
- public void run() {
- ChatManager.Instance().getConversationListAsync(types, lines, new GetConversationListCallback() {
- @Override
- public void onSuccess(List<ConversationInfo> conversationInfos) {
-
- }
-
- @Override
- public void onFail(int errorCode) {
-
- }
- });
- }
- });
- 都无法获取到数据