Android 从阵列加载SimpleCorsorAdapter
是否可以从我制作的数据数组中加载SimpleCorsorAdapter? 以下是加载我的阵列的方式:Android 从阵列加载SimpleCorsorAdapter,android,arrays,simplecursoradapter,Android,Arrays,Simplecursoradapter,是否可以从我制作的数据数组中加载SimpleCorsorAdapter? 以下是加载我的阵列的方式: String[][] arrayStixoi = new String[countCategory][countCategory]; int i = 0; while(ccget.moveToNext()){ String stixoi = ccget.getString(ccget.getColumnIndex("
String[][] arrayStixoi = new String[countCategory][countCategory];
int i = 0;
while(ccget.moveToNext()){
String stixoi = ccget.getString(ccget.getColumnIndex("stixoi"));
String syggraf=ccget.getString(ccget.getColumnIndex("syggrafeas"));
String notes=ccget.getString(ccget.getColumnIndex("syggrafeas"));
String news=ccget.getString(ccget.getColumnIndex("syggrafeas"));
arrayStixoi[i][0] = Integer.toString(i);
arrayStixoi[i][1] = stixoi;
arrayStixoi[i][2] = syggraf;
arrayStixoi[i][3] = notes;
arrayStixoi[i][4] = news;
i++;
String _id=arrayStixoi[i][0]+1;
}
现在我想让arrayStixoi加载一个SimpleCrsorAdapter,然后将这个适配器添加到ListView
这可能吗?怎么做
提前感谢您抽出时间。在您的代码片段中
ccget.moveToNext()
我假设ccget
是Cursor
的一个实例。这样,您就可以使用默认构造函数实例化一个SimpleCursorAdapter
:
new SimpleCursorAdapter(
this, R.layout.your_layout,
ccget,
from,
to,
flags)
请参阅。对于阵列,您最好使用阵列适配器。(如果你仍然想使用CURSOR适配器,考虑一个MatrxCurror)你能给我举个例子吗?