Currently I have a query that looks at the table and returns the newest row, reads that row and sets the string to the value in the chosen column index.
At the moment I have 9 columns so I have end up making 9 methods for returning each column just to return a string and set it to each individual textview.
Do I make a cursor to return the row and then set the column index when I am setting the textviews. Something like
cursor.getString(1)
This is my current query
public String getName() {
// TODO Auto-generated method stub
String[] columns = new String[] { KEY_ROWID, KEY_NAME, KEY_COLUMN2,
KEY_COLUMN3, KEY_COLUMN4, KEY_COLUMN5, KEY_COLUMN6, KEY_COLUMN7, KEY_COLUMN8 };
Cursor c = mDb.query(true, DATABASE_TABLE, columns, null, null, null,
null, "_id DESC", "1");
if (c != null) {
c.moveToFirst();
String name = c.getString(1);
return name;
}
return null;
}