Android – how to retrieve a single row data from cursor android

android

I want to retrieve the data from cursor when pressing the button. For the first time I want to show first row data, after pressing button I need to show second row data. How can I achieve this? I have more number of rows in my database.

While I am using following code I am getting last row data.

for(int i=0;i<cursor.getColumnCount();i++){
    String path=c.getString(2);
    Bitmap bitmap=BitmapFactory.decodeFile(path);
    title.setText(c.getString(1));
    brewerimage.setImageBitmap(bitmap);
}

Best Solution

For the first timebutton click, cursor.moveToFirst();

Then keep on using, cursor.moveToNext()

until end of the row.

To be more specific:

 if (cursor.moveToFirst()) {
    do {
                            String path=c.getString(2);
                            Bitmap bitmap=BitmapFactory.decodeFile(path);
                            title.setText(c.getString(1));
                            brewerimage.setImageBitmap(bitmap);

                        } while(cursor.moveToNext();
}