4

我想通过使用 android 中视图寻呼机的当前位置从数据库中检索数据,但是当我尝试它时,前两个页面使用相同的数字。有没有办法使用寻呼机的当前位置来检索数据?

public void onPageSelected(int arg0) {          
    int a = arg0 + 1;
}

我传递了“a”的值,但第二页在视图寻呼机中也使用了值 a 作为 1。

我在片段中使用了以下内容,

DBMain dbm1 = new DBMain(context); dbm1.open();

    Cursor cursor = dbm1.getSGGS(no);//'no' is the number 'a'
    if (cursor.moveToNext()) {
        for (int i = 0; i < cursor.getCount(); i++) {

            array.add(cursor.getString(cursor
                    .getColumnIndex("abc")));


            cursor.moveToNext();

}

但是前两个将使用'a'作为1。我想让第二个片段使用'a'作为2然后3......

提前致谢

4

1 回答 1

0

清除了错误。获取 onCreate 而不是 onCreateView 的值。

谢谢回复

于 2013-08-20T09:48:24.060 回答