There is a database with a _year table and a _foto integer column in it. It contains links to images (namely R.drawable.img). How can I put these links in an int [] array?
- I doubt very much that links can be placed in an array int [], because links are usually text, and int is a numeric data type. And there are no arrays in the database, you need to indicate in which language you have this array and it would be nice to show what you yourself tried to do - Mike
|
1 answer
As I understand it, this is Android and Java.
You can query SQLiteDatabase:
rawQuery("select _foto from _year", new String[]{}) Get Cursor and get around it:
List<Integer> list = new ArrayList<>(); while (cursor.moveToNext()) { list.add(cursor.getInt(0)); } After convert the list to an array:
int[] array = new int[list.size()]; list.toArray(array); |