Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration to newer UIL version #169

Closed
nostra13 opened this issue Feb 9, 2013 · 10 comments
Closed

Migration to newer UIL version #169

nostra13 opened this issue Feb 9, 2013 · 10 comments
Labels

Comments

@nostra13
Copy link
Owner

nostra13 commented Feb 9, 2013

If you have some issues on migration to newer library version - write your questions here.
Post your code which ceased to be compiled after library update.

@alipersian
Copy link

Hi nostra13, thanks for the source.
I am working on my app that one part of that is to retrieve images from a folder inside of my host
I put the jar file that you mentioned in the lib of my app.
and add these line to my app:

        String imageUri = "http://www.mysite/store/image/i1.jpg";
        ImageLoader imageLoader;
    ImageView imgView;

imageLoader.displayImage(imageUri, imageView);
imageLoader.loadImage(imageUri, new SimpleImageLoadingListener() {
    @Override
    public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
            }
});
// Load image, decode it to Bitmap and return Bitmap synchronously
Bitmap bmp = imageLoader.loadImageSync(imageUri);

is there any thing else that I need to do?
tnx a lot

@nostra13
Copy link
Owner Author

nostra13 commented Apr 2, 2014

Yes, you should investigate the sample app and see how to use the library in a right way.

@zhchzs
Copy link

zhchzs commented Apr 9, 2014

加载比较大的图片的时候还是会有点问题,尤其是在gridview里

@nostra13
Copy link
Owner Author

写英文

@zhounanzhao
Copy link

zhchzs said: there are some questions when loading big image.especially in gridview.(That is all he said.)

@yangxuefeng1992
Copy link

First My English is not good.I hope you can understand what I mean .thank you for your open source code. I'm a newbie for andriod. i just a chinese student. You can provide some kind of learning method for android?

@brucetoo
Copy link

hey, nostra13. I met a problem when i use this~ Promble may like this: when I use ImageLoader.getInstance().loadImage(...) to download a gif , In the callback method :

                  @Override
                    public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
// I just want to get diskCache ,but sometimes it return NULL, I just dont know why,Importantly,its sometimes,not always. Absolutely,I have config DisplayImageOptions .cacheInMemory(true),
                .cacheOnDisk(true)
   File file = DiskCacheUtils.findInCache(imageUri, ImageLoader.getInstance().getDiskCache());
}

Do u know why ?Hope ur help...please

@weblu2000
Copy link

Hello nostra13 I got the following error and I don't understand why:

UIL doesn't support scheme(protocol) by default [ http://www.atlantisipad.it/atlantis.ipad/atlantis3_2015.jpg]. You should implement this support yourself (BaseImageDownloader.getStreamFromOtherSource(...)) java.lang.UnsupportedOperationException: UIL doesn't support scheme(protocol) by default [http://www.atlantisipad.it/atlantis.ipad/atlantis3_2015.jpg]. You should implement this support yourself (BaseImageDownloader.getStreamFromOtherSource(...))at com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStreamFromOtherSource(BaseImageDownloader.java:280) at com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStream(BaseImageDownloader.java:99)at com.nostra13.universalimageloader.core.decode.BaseImageDecoder.getImageStream(BaseImageDecoder.java:98) at com.nostra13.universalimageloader.core.decode.BaseImageDecoder.decode(BaseImageDecoder.java:74) at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.decodeImage(LoadAndDisplayImageTask.java:265) at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryLoadBitmap(LoadAndDisplayImageTask.java:238) at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.run(LoadAndDisplayImageTask.java:136) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818)

I have to visualizze an images jpg from xml file.
here the java class code
`public class SitesAdapter extends ArrayAdapter {

ImageLoader imageLoader;
DisplayImageOptions options;


public SitesAdapter(Context ctx, int textViewResourceId, List<AtlantisSite> sites) {
    super(ctx, textViewResourceId, sites);

    //Setup the ImageLoader, we'll use this to display our images
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(ctx).build();
    imageLoader = ImageLoader.getInstance();
    imageLoader.init(config);

    //Setup options for ImageLoader so it will handle caching for us.
    options = new DisplayImageOptions.Builder()
            .cacheInMemory(true)
            .cacheOnDisk(true)
            .build();
}

/*
 * (non-Javadoc)
 * @see android.widget.ArrayAdapter#getView(int, android.view.View, android.view.ViewGroup)
 * 
 * This method is responsible for creating row views out of a AtlantisSite object that can be put
 * into our ListView
 */

@Override
public View getView(int pos, View convertView, ViewGroup parent){
    RelativeLayout row = (RelativeLayout)convertView;
    Log.i("AtlantisSites", "getView pos = " + pos);
    if(null == row){
        //No recycled View, we have to inflate one.
        LayoutInflater inflater = (LayoutInflater)parent.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        row = (RelativeLayout)inflater.inflate(R.layout.row_site, null);
    }

    //Get our View References
    final ImageView iconImg = (ImageView)row.findViewById(R.id.iconImg);
    TextView nameTxt = (TextView)row.findViewById(R.id.nameTxt);
    TextView titleTxt = (TextView)row.findViewById(R.id.titleTxt);
    final ProgressBar indicator = (ProgressBar)row.findViewById(R.id.progress);

    //Initially we want the progress indicator visible, and the image invisible
    indicator.setVisibility(View.VISIBLE);
    iconImg.setVisibility(View.INVISIBLE);

    //Setup a listener we can use to swtich from the loading indicator to the Image once it's ready
    ImageLoadingListener listener = new ImageLoadingListener(){



        @Override
        public void onLoadingStarted(String arg0, View arg1) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onLoadingCancelled(String arg0, View arg1) {
            // TODO Auto-generated method stub
        }

        @Override
        public void onLoadingComplete(String arg0, View arg1, Bitmap arg2) {
            indicator.setVisibility(View.INVISIBLE);
            iconImg.setVisibility(View.VISIBLE);
        }

        @Override
        public void onLoadingFailed(String arg0, View arg1, FailReason arg2) {
            // TODO Auto-generated method stub              
        }
    };

    //Load the image and use our options so caching is handled.
    imageLoader.displayImage(getItem(pos).getImgUrl(), iconImg,options, listener);

    //Set the relavent text in our TextViews
    nameTxt.setText(getItem(pos).getName());
    titleTxt.setText(getItem(pos).getTitle());

    return row;


}

}

@nostra13
Copy link
Owner Author

Most likely you pass wrong URL into ImageLoader. Check what URL you pass in debug mode.

@weblu2000
Copy link

There was a mistake in my xml file in the server. I put a space between link and < >
Thank You

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants