I'm a beginner in Android, my problem is I can't pass the captured image to another activity for it to be manipulated. My plan is to save the captured photo in byte since i only need it temporarily then pass it to another activity or for the sake of manipulating the image. Is their a way for me to get its "jpg url" without saving to the user's gallery? Thanks in advance.
EDIT: Here are some code from CameraUtility class added with
bitmapPicture = BitmapFactory.decodeByteArray(arg0 , 0, arg0.length);
...
try{
//Write File
String filename="bitmap.png";
FileOutputStream stream = getApplicationContext().openFileOutput(filename, Context.MODE_PRIVATE);
// bitmapPicture.compress(Bitmap.CompressFormat.JPEG, 50, stream);
bitmapPicture = BitmapFactory.decodeByteArray(arg0 , 0, arg0.length);
//Cleanup
stream.close();
Toast.makeText(getApplicationContext(), "Saved", Toast.LENGTH_LONG).show();
bitmapPicture.recycle();
//Pop intent
Intent in1 = new Intent(CameraUtility.this, Receiver.class);
in1.putExtra("image", filename);
startActivity(in1);
}catch (Exception e){
e.printStackTrace();
}
Receiver class...
public class Receiver extends AppCompatActivity{
protected void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bitmap bitmapPicture = null;
String filename = getIntent().getStringExtra("image");
try{
FileInputStream is = this.openFileInput(filename);
bitmapPicture = BitmapFactory.decodeStream(is);
is.close();
}catch (Exception e){
e.printStackTrace();
}
setContentView(R.layout.receive_bitmap);
ImageView viewBtimap = findViewById(R.id.bitmapview);
viewBtimap.setImageBitmap(bitmapPicture);
}
EDIT: But now, it doesn't have an error. But the image won't pass on to another activity.