My code needs to get the data from the database, in short it just needs the following commands:
if (cursor.moveToNext()) {
Contato contato = new Contato();
contato.setCodigo(cursor.getInt(cursor.getColumnIndex("ID")));
contato.setNome(cursor.getString(cursor.getColumnIndex("NOME")));
contato.setTelefone(cursor.getString(cursor.getColumnIndex("TELEFONE")));
return contato;
} else
return null;
I wanted to know if it's possible to get DB data without using ListView or Spinner (using only TextView in only one xml layout) ! So I need to get only data from a particular row ( row ) of a particular table, that line will be informed by the user!
I have several contacts (name, phone, email) in the DB but I do not want to display type all DB contacts in main.xml
, only type 1 contact informed by the user! Does anyone know how to get DB data without needing this:
adapter = new SimpleCursorAdapter(this, R.layout.contacto_list_item, cursor, columns, to);
this.setListAdapter(adapter);
I do not want to use ListView or Spinner !