0

I'm building an app for a friends funny pictures website. I downloaded the gridview activity from the android developers website, but it just loads preset image urls, and that's simply not going to work for us. We need an image loader that can automatically load images from the site.

Any help would be greatly appreciated.

Able
  • 47
  • 5

4 Answers4

2

Use lazylist download https://github.com/thest1/LazyList

Lazy load of images in ListView

Community
  • 1
  • 1
Nitin Gupta
  • 287
  • 2
  • 13
1

Hope AQuery library is what you are looking for easy image loading on ImageView

laaptu
  • 2,963
  • 5
  • 30
  • 49
0

Try out this

Drawable drawable = LoadImage(<Replace this with your url> + UserProfile.Photo);
UserPhotoImageView.setImageDrawable(drawable);
<replace with Your Image View>.setImageDrawable(drawable);


public Drawable LoadImage(String url)
    {
        try
        {
            InputStream is = (InputStream) new URL(url).getContent();
            Drawable d = Drawable.createFromStream(is, "src name");
            return d;
        }
        catch (Exception e)
        {
            System.out.println("Exc=" + e);
            return null;
        }
    }
Murtuza Kabul
  • 6,438
  • 6
  • 27
  • 34
  • 1
    I can see the next question from the beginner: "I get a NetworkOnUiThreadException". You should try to explain a bit and show some effort in your answer. "try out this [some code]" is nothing... (beside the ugly stuff you have there: `System.out.println()`) – WarrenFaith Mar 22 '13 at 12:04
0

Rather than what others are suggesting, I think the best way to do this is use a UniversalImageLoader. It will allow you to Lazy Load, and cache on the SD card and internal storage. In short, it makes things simpler and allows you to get the fastest speed possible. Try it out.

Kgrover
  • 2,106
  • 2
  • 36
  • 54