Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In First activity :</p> <pre><code> Button b=(Button)findViewByid(R.id.button); b.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { doTakePhotoAction(); } }); private void doTakePhotoAction() { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); mUri = Uri.fromFile(new File(Environment.getExternalStorageDirectory(), "pic_" + String.valueOf(System.currentTimeMillis()) + ".jpg")); intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, mUri); try { intent.putExtra("return-data", true); startActivityForResult(intent, CAMERA_RESULT); // finish(); } catch (ActivityNotFoundException e) { e.printStackTrace(); } } protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode != RESULT_OK) { return; } if (requestCode == CAMERA_RESULT) { Intent intent = new Intent(this, nextimage.class); // here you have to pass absolute path to your file intent.putExtra("image-path", mUri.getPath()); intent.putExtra("scale", true); startActivity(intent); finish(); } } </code></pre> <p>In nextimage.class you can set one image view and get the imagepath from putExtra and place it in imageview. </p> <pre><code> String mImagePath = extras.getString("image-path"); Bitmap mBitmap = getBitmap(mImagePath); private Uri getImageUri(String path) { return Uri.fromFile(new File(path)); } private Bitmap getBitmap(String path) { Uri uri = getImageUri(path); InputStream in = null; try { in = mContentResolver.openInputStream(uri); return BitmapFactory.decodeStream(in); } catch (FileNotFoundException e) { Log.e(TAG, "file " + path + " not found"); } return null; } </code></pre> <p>place the bitmap in the imageview.you have to create imageview in secondActivity. </p>
    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.
 

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