سلام دوستان
من در اندروید مبتدی هستم . کد زیر روی دستور
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_ list_item_1,array);
خطا میده میشه راهنمایی بفرمایید.
mydb=MyDataBase.getReadableDatabase();
Cursor cursor= mydb.rawQuery("select name from persons_tb", null);String[] array = new String[cursor.getCount()];
int i = 0;
if (cursor.moveToFirst()) {
do {
try {
array[i] = cursor.getString(cursor.getColumnIndex("name"));
i++;
} catch (Exception e) {
e.printStackTrace();
}
} while (cursor.moveToNext());
}
ListView listview=(ListView) findViewById(R.id.listView);ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_ list_item_1,array);
listview.setAdapter(adapter);
- - , .
برچسب:
نویسنده: محمد رضا جوادیان