Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>after taking picture from camera you need to downscale bitmap to set on ImageView to show preview. refer below method:</p> <pre><code>private void showAttachedImagePreview(String imagePath) { Bitmap bitmap = null; //= BitmapFactory.decodeFile(imagePath); BitmapFactory.Options options = new BitmapFactory.Options(); options.inSampleSize = 1; try { bitmap = BitmapFactory.decodeFile(imagePath, options); } catch (OutOfMemoryError e) { e.printStackTrace(); bitmap=null; try { options.inSampleSize = 2; bitmap = BitmapFactory.decodeFile(imagePath, options); } catch (OutOfMemoryError e1) { e1.printStackTrace(); bitmap=null; try { options.inSampleSize = 3; bitmap = BitmapFactory.decodeFile(imagePath, options); } catch (OutOfMemoryError e2) { e2.printStackTrace(); bitmap=null; try { options.inSampleSize = 4; bitmap = BitmapFactory.decodeFile(imagePath, options); } catch (OutOfMemoryError e3) { e3.printStackTrace(); bitmap=null; } } } } if(bitmap!=null) { commentAttachedImagePreview.setVisibility(ImageView.VISIBLE); commentAttachedImagePreview.setImageBitmap(bitmap); commentAttachedImageName.setVisibility(TextView.VISIBLE); commentAttachedImageName.setText(new File(imagePath).getName()); deleteAttachedImage.setVisibility(ImageView.VISIBLE); } try { File file = new File(AppManager.getInstance().DATA_DIRECTORY, "tausif_tmp.png"); FileOutputStream outStream = new FileOutputStream(file); bitmap.compress(Bitmap.CompressFormat.JPEG, 50, outStream); outStream.flush(); outStream.close(); filePath = file.getPath(); } catch(Exception ex) { ex.printStackTrace(); } } </code></pre>
 

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