Take the 2-minute tour ×

I use the following code to display the android message converation.

Cursor cursor = mydatabasehelper.fetchAllData1(type);
if(cursor != null){     
while (cursor.moveToNext()) { 
String name = cursor.getString(cursor.getColumnIndex("type")); 
Log.v("info", "type " + name ); 

if (cur != null && name.equals("send")) {                                        //1213
simpleadapter = new SimpleCursorAdapter(this,R.layout.list_say_he_item,cur, 
new String[] {"type","det","tim" }, new int[] {R.id.neirong,R.id.single_text,R.id.tim2});    
simpleadapter = new SimpleCursorAdapter(this,R.layout.singletext,cur, 
new String[] {"type","det","tim" }, new int[] {R.id.send_receive_text,R.id.single_text,R.id.tim2});

But the result is that it just displays the same type layout.

How to display the different layout according to the name value in the conversation?

Ask for the help. Thanks in advance!

share|improve this question
add comment


Your Answer



Browse other questions tagged or ask your own question.