2
I made an example of a ListView
where it is used ArrayList
to fill in the TextView
and ImageView
. But I’m improving it by taking data from a Mysql database, with respect to the `Textview all right, but as I would pull the images, I didn’t want to put the images in the database but upload to the mobile device that will use APK.
I didn’t quite understand your question in case you want to download the images to the application?
– claudsan
That’s right @claudsan, I wanted to send the images to the app, I don’t know if I’m right, but for that I would just throw in the drawable folder, right? but how do I have an index to fetch the images when popular the listview? Let me show how I am doing in the manual option:
– JamesOrtiz
public static final Integer[] images = {
 R.drawable.img1,
 R.drawable.img2,
 R.drawable.img3,
 R.drawable.img4};
– JamesOrtiz
@Jamesortiz The folder
res/drawable/
is used to save files that are included there at project time, not at application runtime. In other words, you won’t be able to save images that your app downloads to it. When downloading an image from the bank, you will have to save it to a file on the device’s file system (internal memory or sd card).– Piovezan
@Piovezan the best way then would be to store the images in MYSQL?
– JamesOrtiz
@Jamesortiz First you stated that the images would come from a remote server (Mysql), now you’re asking if it’s the best way to store? On the remote server you can save as you prefer, in a database or as a file, available from a link to an image or even as a return of a webservice (REST for example).
– Piovezan
@Piovezan, I think I expressed myself badly, I apologize. I have the database but only with text and would like to know how to work with the images. I found interesting the idea of the link, I will search if I find some help in Google on this. Grateful
– JamesOrtiz
@Jamesortiz I think the idea of the same link is better, and also in the case of the text it is better to come via webservice. Making the application connect to a remote database is not recommended, it is better for the webservice to do so and make it available in some format (JSON, XML, plain text or binary data, as the case may be).
– Piovezan
@Jamesortiz Give a look here http://stackoverflow.com/questions/15549421/how-to-download-and-save-an-image-in-android this one in English but it has the full example I think will suit.
– claudsan