Pergunta

I'm a little confused about how to use the cursor to access the data that I need using the CursorLoader model. I was able to use a SimpleCursorAdapter and pass the cursor to the swapCursor method of the adapter within the onLoadFinished method that you have to implement as follows.

@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {

    facilityAdapter.swapCursor(cursor);

}

Now I need to query the database and based on the number of rows returned display an integer. How do I access this information? There is some information that I would like to store (the _id) of certain rows selected so that I can bundle it up and pass it to the next activity, because the id is a foreign key in other database tables and I'll need to to query the database. On the android developer site I've seen that there are accesor methods to the cursor class such as cursor.getInt, cursor.getString, etc etc, should I be using these to access the data that I am after.

Nenhuma solução correta

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top