Hi everyone,
I'm population my listView using Cursor, but when I navigate away from my activity and then return back my listview is empty. Here is my code:
@Override
public void onCreate(Bundle savedInstanceState) {
...
DBAdapter db = new DBAdapter(context);
db.open();
Cursor c = db.getAll();
db.close();
startManagingCursor(c);
String[] columns = new String[] { ... };
int[] to = new int[] { ... };
SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(this, R.layout.list_item, c, columns, to);
this.setListAdapter(mAdapter);
...
}
I've seen here questions about saving position of Cursor, but not the Cursor itself. Probably I just missing something, shall I save my cursor (how can I do it?) or it's better(faster, cheaper) to create new cursor every time using my DBadapter?
Thanks