2

I am using GRAPH API to get posts of a facebook page. For posts which contains picture, the response contains the picture URL.

Response= {id:"...", message:"...",picture:"jpg image url"}

I am trying to load the image from the above URL resulted from GRAPH API.

And using below code to load image from URL. How to load an ImageView by URL in Android?

I see resulting bitmap is not null, but my imageview shows nothing(not even a default image I set in the XML).

Note: Image is a jpg format.

Community
  • 1
  • 1
vinod
  • 53
  • 7

2 Answers2

1

Try this Library https://github.com/nostra13/Android-Universal-Image-Loader

with below code

 ImageLoader imageLoader = ImageLoader.getInstance();
            imageLoader.init(ImageLoaderConfiguration.createDefault(this));

            DisplayImageOptions options = new DisplayImageOptions.Builder()
            .showStubImage(R.drawable.null_avtar) //this is the image that will be displayed if download fails
            .cacheInMemory()
            .cacheOnDisc()
            .build();

            imageLoader.displayImage(avtar_url, mImageView, options);
Harsh Patel
  • 1,056
  • 2
  • 10
  • 20
0

Found Error myself: Actually image is getting loaded with above code.I was using a textview and then a imageview in a linear layout. When the content exceeds the screen, image is not displayed(however textview is scrolling by default). So I used a scrollview and then I can see the image even content exceeds the screen.

vinod
  • 53
  • 7