android短信会话显示问题
代码如下:
Cursor cursor = mydatabasehelper.fetchAllData1(type);
if(cursor != null){
while (cursor.moveToNext()) {
String name = cursor.getString(cursor.getColumnIndex("type"));
Log.v("info", "类型是 " + name );
if (cur != null && name.equals("发送")) { //1213
System.out.println("发送(green)++++++++++++");
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});
}else{
System.out.println("接收(white)————————");
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});
}
setListAdapter(simpleadapter);
simpleadapter.notifyDataSetChanged();
}
cursor.close();
}
得到结果老是只显示一种layout,如何在会话中根据name的值,显示不同layout,求大神帮忙