I am getting a string output to this c.getString(0) method. I want to know how do I store this output into an array in Java? This c.getString(0) method is in a while loop. Each time the while loop runs, I want to store whatever the value I get with c.getString(0) method to store in an array. How can I do that?
private void showList() {
DataBaseHelper db = new DataBaseHelper(this);
db.open();
c = db.retriveall();
if (c.moveToFirst()) {
do {
Toast.makeText(MainActivity.this,
"_id: " + c.getString(0) + "\n",
Toast.LENGTH_LONG).show();
} while (c.moveToNext());
}
}
For now I'm showing it an toast message. Instead of showing I want to store it to an array. please help me