I have a TabActivity with 3 tabs, one of them has a ListActivity. here is my problem, with the method setListAdapter i cant click on the other two tabs anymore. i dont know why. is there a way to solve this problem?
public class second extends ListActivity {
SQLiteDatabase myDB = null;
static final int MENU_NEW_KFZ = 0;
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
myDB = this.openOrCreateDatabase(HelloTab.MY_DB_NAME, MODE_PRIVATE, null);
Cursor c = myDB.rawQuery("SELECT _id, name, model FROM " + HelloTab.MY_DB_TABLE + ";", null);
startManagingCursor(c);
开发者_如何学JAVA SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
android.R.layout.simple_list_item_1,
c,
new String[] { "_id" },
new int[] { android.R.id.text1 });
adapter.setViewBinder(new ViewBinder() {
public boolean setViewValue(View view, Cursor theCursor, int column) {
String ColumnName = theCursor.getString(1); //Name
String ColumnModel = theCursor.getString(2); //Model
((TextView)view).setText(ColumnName + ", " + ColumnModel);
return true;
}
});
setListAdapter(adapter);
}
try these af.notifyDataSetChanged();
where af
is your adpater hope it helped.
精彩评论