0
我有一個TabActivity有3個選項卡,其中一個具有ListActivity。 這裏是我的問題,使用方法setListAdapter我不能再點擊其他兩個選項卡。我不知道爲什麼。有沒有辦法解決這個問題?setListAdapter方法不能用TabActivity
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);
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);
}