Next, I have 2 questions that relate, so I'll do it in 1 topic.
Well, I use this query to return a list of strings with the names of the products.
public List<String> getMedico() {
List<String> list = new ArrayList<>();
Cursor cursor = database.rawQuery("SELECT nome FROM Armas Where Classe like 'médico' ORDER BY nome ASC", null);
cursor.moveToFirst();
while (!cursor.isAfterLast()) {
list.add(cursor.getString(0));
cursor.moveToNext();
}
cursor.close();
return list;
}
When I click on a list item it opens a new details page, which shows all the other attributes of the product. Here, on this page, I retrieve the image by passing the item name as a parameter.
public byte[] getImage(String name) {
byte[] data = null;
Cursor cursor = database.rawQuery("SELECT imagem FROM Armas WHERE nome = ?", new String[]{name});
cursor.moveToFirst();
while (!cursor.isAfterLast()) {
data = cursor.getBlob(0);
break;
}
cursor.close();
return data;
}
Blz, this works quietly. Now, what I need: Return a "list of images". Instead of returning the name, I want to return the images and put them in a listview. But I have no idea how. But blz does this by asking the second question: When it is ready, it will return 300 images of ± 15kb each. Overall it gives almost 4mb. Returning this much of image can weigh in the application at the time of opening this screen? What if you have 3 fragments returning 300 images each?
Ah, I want to do in sqlite and not put in drawables because the pq beyond image will have name and description. Or would it be better to put in drawables, put in sqlite only the path of the image and return it in some way?