Search code examples
javaandroiduniversal-image-loader

SetImageview resource from image on cache downloaded by UIL lib


Actually I am using UIL for downloading image from my url. I used below code to download. but not I m not able to get how to display image downloaded in my Mainactivity. One thing I noted is it downloading image in cache, so I got path of that file as /storage/android/data/test/cache/1235456. Now can u guide how can I set this path to image source so that I can be loaded during app startup. Or there is other better way to put these images in imageview. I read code of UIL and their sample application, bit confused.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ImageView ivUIL = (ImageView) findViewById(R.id.imageview1);
    String url = "myurl";
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext()).build();
    ImageLoader.getInstance().init(config);
    ImageLoader.getInstance().displayImage(url,ivUIL);
}

Solution

  • Panache you can try to this it can help me..

     ImageView   ivUIL = (ImageView) findViewById(R.id.ivUIL);
    
     String url = "http://innovativedevicesapps.me/Images/big banner.jpg";
    
    
     ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext()).build();
        ImageLoader.getInstance().init(config);
        ImageLoader.getInstance().displayImage(GlobleArray.array.get(position).getStrUrl(), ivUIL);
    

    OR

      ImageLoader.getInstance().displayImage(url , ivUIL);