过程中的ImageView加载几个图像获取内存异常 [英] During the Loading several images in ImageView get Out of Memory exception

查看:154
本文介绍了过程中的ImageView加载几个图像获取内存异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我已经创建了一个应用程序。

Hello I have created an Application.

在应用程序加载我从URL中的几个图像。但是,图像的加载过程中我得到的内存不足例外。

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.

推荐答案

好了,从现在互联网图片加载时间有很多的解决方案。你也可以使用这个库Android的查询 https://开头code.google.com / p / Android的查询/维基/ ImageLoading 。它会给你所有需要的activity.Make确定你想做什么?并阅读图书馆的wiki页面。解决图像加载限制。

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.

这是我的code: -

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

这篇关于过程中的ImageView加载几个图像获取内存异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆