public List<String> getDays(long iid)
{
List<String> days= new ArrayList<String>();
cursor = database.query(MySqliteHelper.TABLE_REPEAT, daysColumn, MySqliteHelper.COLUMN_TID + "=" + iid, null, null, null, null);
while(fg>=1)
{
cursor = database.query(MySqliteHelper.TABLE_REPEAT, daysColumn, MySqliteHelper.COLUMN_TID + "=" + iid, null, null, null, null);
String day = cursor.getString(cursor.getColumnIndex(MySqliteHelper.COLUMN_DAYS));
days.add(day);
cursor.moveToNext();
if(cursor.isAfterLast())
{
fg=0;
}
}
cursor.close();
fg=1;
return days;
}
現在我得到arrayindexoutofbound
異常!我是新來的Android和編程.. 建議我使用什麼技術。從表中取多個值
和我的日誌貓顯示: 11月3日至6日:20:12.941:E/AndroidRuntime(2025):致命異常:主要 11月3日至6日:20:12.941:E/AndroidRuntime(2025):JAVA。 lang.RuntimeException:無法啓動活動ComponentInfo {com.example.habitator/com.example.habitator.AlarmDays}:android.database.CursorIndexOutOfBoundsException:請求索引-1,大小爲1
親愛的,你確切地知道'光標'是什麼?以上代碼你在做什麼? – 2013-03-06 10:31:49
我編輯了我的問題。請檢查 – AnRu 2013-03-06 10:52:34