请看下面的代码
public List getWordList(int listNumber) {
// TODO Auto-generated method stub
List<String> list_a = new ArrayList<String>();
List<String> wordList = new ArrayList<String>();
int counter = 0;
try
{
String selectQuery = "select * from WordList";
Cursor cursor = database.rawQuery(selectQuery, null);
if(cursor.moveToFirst())
{
do
{
String englishWord = cursor.getString(cursor.getColumnIndex("EnglishWord"));
String portugueseWord = cursor.getString(cursor.getColumnIndex("PortugueseWord"));
String englishHint = cursor.getString(cursor.getColumnIndex("EnglishHint"));
String portuguestHint = cursor.getString(cursor.getColumnIndex("PortugueseHint"));
list_a.add(englishWord);
list_a.add(portugueseWord);
list_a.add(englishHint);
list_a.add(portuguestHint);
}
while(cursor.moveToNext());
//Toast.makeText(context, "Data Retrieved: "+branches.get(1), Toast.LENGTH_LONG).show();
}
cursor.close();
return list_a;
}
catch(Exception e)
{
Toast.makeText(context, "Exception: "+e.getLocalizedMessage(), Toast.LENGTH_LONG).show();
return null;
}
}
在这里,我正在获取从第一行到最后一行的数据。但是,这不是我需要的。如果'number',参数是1,我需要0-9行的数据,如果'number'是2,我需要10-19行的数据如果'number'是3,我需要20行的数据-29 一样明智。
我不熟悉 SQLite,那么我该怎么做呢?