Android Studio Debbuger view content from a Cursor

0

I am debugging an application and would need to know which branch to enter to see the contents of when Cursor.getString (int) is called;

To see if you are grabbing something from my Database and if you grab it, check that it's what I'm looking for! Thank you very much

    
asked by Franco Rolando 22.11.2018 в 22:50
source

1 answer

1

One way would be to create int of your columns:

 int idIndex = cursor.getColumnIndexOrThrow(Columna_ID);
 int tituloIndex = cursor.getColumnIndexOrThrow(Columna_Titulo);

Then you create a ArrayList String, the cursor reads the database and add them to the arraylist

 ArrayList<String> miArrayList = new ArrayList<String>();
    while(cursor.moveToNext()) {
        miArrayList.add(cursor.getString(tituloIndex)); // ó idIndex
    }

And you show it in the LogCat:

 Log.i("MIRA_ARRAY", String.valueOf(miArrayList));  // muestra todos
 Log.i("MIRA_UNO", String.valueOf(miArrayList.get(0)));  // muestra solo el primero
    
answered by 22.11.2018 в 23:51