0

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.

Sagar Zala
  • 4,854
  • 9
  • 34
  • 62
  • 1
    Come on, did you even google it ?? There are literally dozens of duplicates for this question ! http://developer.android.com/training/displaying-bitmaps/load-bitmap.html – 2Dee Feb 06 '14 at 09:43
  • 1
    @Angel, OutOfMemoryException has nothing to do with using AsyncTasks ... – 2Dee Feb 06 '14 at 09:44

1 Answers1

4

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

Dev 9
  • 263
  • 2
  • 5