I have selected an image and cropped it. But I want to save the cropped image uri in shared preference so that it can be showed later. I know how to save in shared preference, but the problem key is "how I can get the image URL of the cropped image"
........................
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
// code for crop image
intent.putExtra("crop", "true");
intent.putExtra("aspectX", 0);
intent.putExtra("aspectY", 0);
intent.putExtra("outputX", 200);
intent.putExtra("outputY", 150);
intent.putExtra("return-data", true);
startActivityForResult(Intent.createChooser(intent, getString(R.string.image_action)),
Code);
........................
And in onActivtyResult()
I retrieve it:
if (resultCode == Activity.RESULT_OK) {
if (requestCode == SELECT_IMAGE) {
Bundle extras = data.getExtras();
Bitmap photo = extras.getParcelable("data");
imageView.setImageBitmap(bm);
// I want to save the cropped bitmap image's url into preference here
}
}
I can save the bitmap in preference in Base64
format, but it is not recommended to save such huge data in preference. How can I save only the url of the new cropped image so that I can retrieve the image later.