As I say at the title, I want to save my cursor's values to an string array. I will use this array in a ArrayAdapter and call setLineAdapter(ArrayAdapter).. I have these codes but LogCat says at arr[i] = crr.getString(i) line have a problem... Can somebody help me?
DBAdapter db;
String arr[];
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
db = new DBAdapter(this);
db.open();
ArrayAdapter<String> AA = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, arr);
try {
Cursor crr = db.getRecord(4);
crr.moveToFirst();
for (int i = 0; i <= cr.getCount(); i++){
arr[i] = cr.getString(i);
crr.moveToNext();
}}
catch (IOException e) {e.printStackTrace();}
setListAdapter(AA);
db.close();