public static Conversation getConversation(Cursor cursor) { Conversation conversation = new Conversation(); conversation.setId(cursor.getInt(cursor.getColumnIndex(MobiComDatabaseHelper.KEY))); conversation.setGroupId(cursor.getInt(cursor.getColumnIndex(MobiComDatabaseHelper.CHANNEL_KEY))); String topicId = cursor.getString(cursor.getColumnIndex(MobiComDatabaseHelper.TOPIC_ID)); if (!TextUtils.isEmpty(topicId)) { conversation.setTopicId(topicId); } String topicDetail = cursor.getString(cursor.getColumnIndex(MobiComDatabaseHelper.TOPIC_DETAIL)); if (!TextUtils.isEmpty(topicDetail)) { conversation.setTopicDetail(topicDetail); } String userId = cursor.getString(cursor.getColumnIndex(MobiComDatabaseHelper.USERID)); if (!TextUtils.isEmpty(userId)) { conversation.setUserId(userId); } conversation.setTopicLocalImageUri(cursor.getString(cursor.getColumnIndex(MobiComDatabaseHelper.TOPIC_LOCAL_IMAGE_URL))); return conversation; }
public synchronized void processConversationArray(Conversation[] conversations, Channel channel, Contact contact) { if (conversations != null && conversations.length > 0) { for (Conversation conversation : conversations) { if (channel != null) { conversation.setGroupId(channel.getKey()); } else if (contact != null) { conversation.setUserId(contact.getUserId()); conversation.setGroupId(0); } if (conversationDatabaseService.isConversationPresent(conversation.getId())) { conversationDatabaseService.updateConversation(conversation); } else { conversationDatabaseService.addConversation(conversation); } } } }
channelFeed.getConversationPxy().setGroupId(channelFeed.getId()); ConversationService.getInstance(context).addConversation(channelFeed .getConversationPxy());