During the Loading several images in ImageView get Out of Memory exception [duplicate]

孤街浪徒 提交于 2019-12-10 12:25:16

问题


Hello I have created an Application.

In application i loading the several images from URL. But during the loading of images i get the Out Of Memory exception.

Give me solution about this problem.


回答1:


Well, Now image loading time from internet has many solution. You may also use this library "Android-Query" https://code.google.com/p/android-query/wiki/ImageLoading .It will give you all the required activity.Make sure what you want to do ? and read library wiki page. and solve image loading restriction.

This is my code:-

@Override
public View getView(int position, View convertView, ViewGroup parent) {
        View v = convertView;
        if (v == null) {
            LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            v = vi.inflate(R.layout.row, null);
        }

         ImageView imageview = (ImageView) v.findViewById(R.id.icon);
               AQuery aq = new AQuery(convertView);

               String imageUrl = "http://www.vikispot.com/z/images/vikispot/android-w.png";

              aq.id(imageview).progress(this).image(imageUrl, true, true, 0, 0, new BitmapAjaxCallback(){

                       @Override
                       public void callback(String url, ImageView iv, Bitmap bm, AjaxStatus status){

                           iv.setImageBitmap(bm);


                       }

               });

        }
        return v;
}

it should be solve your lazy loading



来源:https://stackoverflow.com/questions/21598984/during-the-loading-several-images-in-imageview-get-out-of-memory-exception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!