1. Are you ready for the Galaxy S20? Here is everything we know so far!

Best way to download and store Images to an app

Discussion in 'Android Development' started by HeavensSentSword, Jan 19, 2016.

  1. HeavensSentSword

    HeavensSentSword Well-Known Member
    Thread Starter

    Hi everyone.
    Ok so I am working out how to best accomplish this task.
    So the basics are;
    1: I want to download a image with a accompanying URL using REST with JSON from a server.
    2: I want to crate an object that has both the image and the URL so they are linked as one object
    3: I want to store the object in a array (this is because there will be multiple objects)
    4:Then load each object into a activity for display purposes.

    I am thinking of making a class that creates the object something like this
    Code (Text):
    1. ImageObject
    2. {
    3.      Image img = "the image.jpg";
    4.      String url = "url.html"
    5. }
    Then when I stream in the data I can parse out the information from each image/url pair and create the object for each pair.

    Then with place each pair as an object into the array for storage into the device memory locally. That way it doesn't have to download every time you want to look at these images. Just when you start up the app.

    Then I want to have a button that when pressed it creates another activity and then loads the image/url pairs for display in like a scrolling layout just in-case there is more than 1 pair.

    Does that sound like a effective way of dealing with this issues? I was looking at the BitmapFactory class and think that that is a good place to start with. Are there any other methods or classes that I should look at?

    Thank you very much for your input into this problem.

    1. Download the Forums for Android™ app!


  2. Unforgiven

    Unforgiven ...eschew obfuscation...

    Application Development thread moved to the Development forum for better exposure.:)
    HeavensSentSword likes this.

Share This Page