Skip to content Skip to sidebar Skip to footer

Setting Imageview In Android

I have a JSON URL :: http://54.218.73.244:7006/DescriptionSortedRating/ JSON STRUCT:: 'restaurants': [ { 'restaurantID': 4, 'restaurantNAME': 'CopperChimney1',

Solution 1:

You can set your Image using ImageLoader...

Create instance of ImageLoader globally like..

  ImageLoader imageLoader;
    @OverrideprotectedvoidonCreate(Bundle savedInstanceState) {
           ......
           imageLoader=newImageLoader(ClassName.this);


            ImageViewimageView= (ImageView) findViewById(R.id.DISP_IMG);
           ......
            imageLoader.DisplayImage(YourImageURLHere,imageView);

Solution 2:

try this

  1. Download AndroidQuery jar from here.

  2. Put this jar to your libs folder and right click on jar and Build Path -> Add to bulid path

  3. How to use see this example

    AQuery androidQuery = new AQuery(this); // make AndroidQuery object 
    
    androidQuery.id(yourImageView).image(imageUrl, isCacheUrlImageOnMemery, isCacheUrlImageOnFile); //  use this way 
    
    isCacheUrlImageOnMemery - iftrue then given url image cahce on memery so after word android query check is given url image cahce on either memery or file then it take from cahce other wise it try to getting from url 
    
    isCacheUrlImageOnFile - same like isCacheUrlImageOnMemery but first of all android query check on memery then file incaseif we have not much of memery then we cahce on file tht y two option are available.
    

Solution 3:

you can use this library to load your image from URL: https://github.com/shaunidiot/AndroidTutorial/tree/master/ionimagetest/bin

refer to this tutorial video of how to do it: http://www.youtube.com/watch?v=zwR44n54-bk

This library will do all the asyncTask process to load and view the image and you can also use placeholder image if the image from the URL is deleted or not available

Post a Comment for "Setting Imageview In Android"