0

I have a question

private final String images[] = {"http://developer.android.com/images/dialog_custom.png", "http://developer.android.com/images/dialog_progress_bar.png"};

how can i change this

to load all of the links from a file from my website?

like a .txt on my site just has like

http://link.com/1.png
http://link.com/2.png
http://link.com/3.png
http://link.com/4.png
http://link.com/5.png
http://link.com/6.png
http://link.com/7.png
http://link.com/8.png
http://link.com/9.png
http://link.com/10.png

so it will just load all those then later on i can add more links without having to update the app

  • you should visit this link may it help you! http://stackoverflow.com/questions/8162568/android-jpg-animation/8162697#8162697 – Hemant Menaria Nov 18 '11 at 04:33

3 Answers3

2

Use a BufferedReader to readLine() to a String and then fetch the image...

LuxuryMode
  • 33,401
  • 34
  • 117
  • 188
0

Just put the space or "," or "/n" in file then get all data in a string one by one

String reader = "";
String separated ;

BufferedReader buffer = new BufferedReader(new FileReader("YourFileName.txt"));
while ((reader = buffer.readLine()) != null) {
    separated = reader.split(" "); or reader.split(","); or reader.split("/n");
    //Here at each itration separated will have your single link
}
buffer.close;
Last Warrior
  • 1,307
  • 1
  • 11
  • 20
-2

Try out the following links:

  1. How to load an ImageView by URL in Android?
  2. http://russenreaktor.wordpress.com/2009/08/11/android-imageloader-load-images-sequencially-in-the-background/

There are plenty of links that provide solutions--enjoy.

Community
  • 1
  • 1
Richa
  • 3,165
  • 1
  • 22
  • 26
  • He wasn't really asking how to load the image; he was asking how to be able to dynamically get ALL of the images without hardcoding them in the app. – LuxuryMode Nov 18 '11 at 04:33