I’m a beginner of SQL.
I would like to display sqlite data on Android listview. The table has the following structure.
| _id | name | data | ...
---------------------
| 0 | A | abc |
| 1 | B | def |
| 2 | C | ghi | ...
| 3 | D | jkl |
| 4 | E | mno |
So, when the user inputs [C, B, D], I want to display name and data column in user’s order.
For example,
ListView
---------------------
C ghi
---------------------
B def
---------------------
D jkl
---------------------
I’m torn between using ArrayAdapter and CursorAdapter now.
Should I do SELECT 3 times, store values in array, and use ArrayAdapter? Or, can fulfill my demands with SELECT once?
Thanks in advance.
It’ll be a bit complicated but it can be done in a single query.
You’ll have to construct the query according to the user input ofcourse
.
Look more here