Open pedrovinicius opened 10 years ago
For a standard ListView
or ListActivity
, just use the toSql()
method like so:
Client
will be our model name.
String query = Client.all().orderBy("name").toSql();
Cursor cursor = ActiveAndroid.getDatabase().rawQuery(query, null);
ClientListCursorAdapter adapter = new ClientListCursorAdapter(this, R.layout.clients_listview_row, cursor, 0 );
this.setListAdapter(adapter);
Take a look at the following StackOverflow answer for a more in depth explanation: http://stackoverflow.com/a/20532937/293280
How I can display the data from database query in a ListView?