How to Save Image in Internal Storage and show image in imageView in another acitivity ,please tell me how to save that image in internal storage because many phones have only internal storage not sd card
this is my first acitivity
//camera
camera = (ImageView) findViewById(R.id.takePic);
camera.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File pictureDirectory=Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
String pictureName=getPictureName();
File imageFile=new File(pictureDirectory,pictureName);
pictureUri=Uri.fromFile(imageFile);
intent.putExtra(MediaStore.EXTRA_OUTPUT,pictureUri);
startActivityForResult(intent,CAMERA_REQUEST_CODE);
}
});
private String getPictureName() {
SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMdd_HHmmss");
String timestamp=sdf.format(new Date());
return "Plane place image"+timestamp+".jpg";
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode==RESULT_OK){
if (resultCode==CAMERA_REQUEST_CODE)
{
pictureUri = data.getData();
if (pictureUri!=null) {
Intent intent = new Intent(this, PictureActivity.class);
intent.setData(pictureUri);
intent.putExtra("imgUrl", pictureUri.toString());
startActivity(intent);
}
}
}
}
this is my second activity
Bundle bundle = getIntent().getExtras();
if (bundle != null) {
Log.e("ashish", bundle.getString("imgUrl") + "");
path = Uri.parse(bundle.getString("imgUrl"));
}
ImageView selfiiii = (ImageView) findViewById(R.id.mySelfie);
selfiiii.setImageURI(path);