Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I changed the getView method to this:</p> <pre><code>public View getView(int position, View convertView, ViewGroup parent) { ImageView imageView = new ImageView(context); try{ BitmapFactory.Options options = new BitmapFactory.Options(); options.inTempStorage = new byte[16*1024]; Bitmap bm = this.decodeFile(images.get(position).toString()); imageView.setImageBitmap(bm); //bm.recycle(); bm = null; System.gc(); } catch(Exception e){ Log.e("DEBUGTAG", "Remtoe Image Exception", e); } imageView.setScaleType(ImageView.ScaleType.FIT_CENTER); imageView.setLayoutParams(new Gallery.LayoutParams(150, 100)); imageView.setBackgroundResource(itemBackground); return imageView; } </code></pre> <p>And I Used a new decode method I got from <a href="https://stackoverflow.com/questions/477572/android-strange-out-of-memory-issue/823966#823966">link</a></p> <pre><code>private Bitmap decodeFile(String f){ try { //Decode image size BitmapFactory.Options o = new BitmapFactory.Options(); o.inJustDecodeBounds = true; BitmapFactory.decodeStream(new FileInputStream(f),null,o); //The new size we want to scale to final int REQUIRED_SIZE=70; //Find the correct scale value. It should be the power of 2. int width_tmp=o.outWidth, height_tmp=o.outHeight; int scale=1; while(true){ if(width_tmp/2&lt;REQUIRED_SIZE || height_tmp/2&lt;REQUIRED_SIZE) break; width_tmp/=2; height_tmp/=2; scale*=2; } //Decode with inSampleSize BitmapFactory.Options o2 = new BitmapFactory.Options(); o2.inSampleSize=scale; return BitmapFactory.decodeStream(new FileInputStream(f), null, o2); } catch (FileNotFoundException e) {} return null; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload