0

我有一个带有 3 个选项卡的 TabActivity,其中一个有一个 ListActivity。这是我的问题,使用 setListAdapter 方法我无法再单击其他两个选项卡。我不知道为什么。有没有办法解决这个问题?

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);
    }
4

1 回答 1

0

try these af.notifyDataSetChanged(); where af is your adpater hope it helped.

于 2011-05-03T13:36:51.000 回答