I am retrieving data from my sqlite database table (which has Id and text) as Cursor
and setting it to ListView
using SimpleCursorAdapter
as below:
Cursor cursor = rawQuery("select IdColumn, TextColumn from Comments where whereArgs ",
new String[]{whereArgs});
adapter = new android.support.v4.widget.SimpleCursorAdapter(context,
android.R.layout.two_line_list_item,
cursor,
new String[]{"IdColumn", "TextColumn"},
new int[]{android.R.id.text1, android.R.id.text2},
0);
listView.setAdapter(adapter);
}
The output is displayed as follows:
I want the data to displayed in ascending order of Id like this;
1
2
3
4
5
6
.....so on.
Please help!
Edit: I am newbie to programming.
Add in your SQL query a ORDER BY ID ASC
.