Activity 1:I have an imageview in which the images taken from camera and gallery are set and it works fine. In this Activity there is a right click button which will redirect you to second activity.
Activity 2: In this Activity I have four options
- Save
- Share
- Share Via Instagram
- Share Via Facebook
Activity 3: From the above four options the third activity works accordingly. Now I don't know how to pass the image taken in first activity to the third activity.
My Effort: In first Activity image taken from camera:
Intent i=new Intent(Camera.this,SaveVia.class);
i.putExtra("image", thumbnail );
startActivity(i);
In Second Activity SaveVia:
Intent intent2 = new Intent(SaveVia.this, Save.class);
Bitmap receiptimage = (Bitmap)getIntent().getExtras().getParcelable("image")
startActivity(intent2);
In third Activity called Save:
Bitmap receiptimage = (Bitmap) getIntent().getExtras().getParcelable("imagepass");
// receipt.setImageBitmap(receiptimage);
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
receiptimage.compress(Bitmap.CompressFormat.PNG, 90, bytes);
File storagePath = new File(Environment.getExternalStorageDirectory() + "/PhotoAR/");
storagePath.mkdirs();
File destination = new File(storagePath, Long.toString(System.currentTimeMillis()) + ".jpg");
FileOutputStream fo;
try {
destination.createNewFile();
fo = new FileOutputStream(destination);
fo.write(bytes.toByteArray());
fo.close();
Toast.makeText(Save.this,"No Error",Toast.LENGTH_LONG).show();
} catch (FileNotFoundException e) {
e.printStackTrace();
Toast.makeText(Save.this,"Error Arrived",Toast.LENGTH_LONG).show();
} catch (IOException e) {
e.printStackTrace();
Toast.makeText(Save.this,"Error Arrived again",Toast.LENGTH_LONG).show();