protected static Bitmap createBitmapAndGcIfNecessary(int width,int height){
  try {
    return Bitmap.createBitmap(width,height,Bitmap.Config.ARGB_8888);
  }
 catch (  OutOfMemoryError e) {
    System.gc();
    return Bitmap.createBitmap(width,height,Bitmap.Config.ARGB_8888);
  }
}

protected static Bitmap createBitmapAndGcIfNecessary ( int width , int height ) { try { return Bitmap . createBitmap ( width , height , Bitmap . Config . ARGB_8888 ) ; } catch ( OutOfMemoryError e ) { System . gc ( ) ; return Bitmap . createBitmap ( width , height , Bitmap . Config . ARGB_8888 ) ; } }
creates a bitmap with the given width and height . < p / > if it fails with an outofmemory error , it will force a gc and then try to create the bitmap one more time .
