如何根据数组元素查询数据库数据
展开全部
拿到cursor对象后调用Cursor类的方法即可
如:
1
2
3
4
5
6
7
8
9
10
String[] strs = new String[cursor.getCount()];
String columnName="";
int position = 0;
// cursor.moveToPosition(position);
cursor.moveToFirst();
while (cursor.moveToNext()) {
int index = cursor.getColumnIndex(columnName);
String str = cursor.getString(index);
strs[position++] = str;
}
如:
1
2
3
4
5
6
7
8
9
10
String[] strs = new String[cursor.getCount()];
String columnName="";
int position = 0;
// cursor.moveToPosition(position);
cursor.moveToFirst();
while (cursor.moveToNext()) {
int index = cursor.getColumnIndex(columnName);
String str = cursor.getString(index);
strs[position++] = str;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询