Avoid select image from gallery occur crash
  BitmapFactory.Options o = new BitmapFactory.Options();         o.inJustDecodeBounds = true;         BitmapFactory.decodeStream(c.getContentResolver().openInputStream(uri), null, o);          int width_tmp = o.outWidth                 , height_tmp = o.outHeight;         int scale = 1;          while(true) {             if(width_tmp / 2 < requiredSize || height_tmp / 2 < requiredSize)                 break;             width_tmp /= 2;             height_tmp /= 2;             scale *= 2;         }          BitmapFactory.Options o2 = new BitmapFactory.Options();         o2.inSampleSize = scale;         return BitmapFactory.decodeStream(c.getContentResolver().openInputStream(uri), null, o2);    http://stackoverflow.com/questions/10773511/how-to-resize-an-image-i-picked-from-the-gallery-in-android/10773946#10773946   
