I've an app that displays a picture to its users. It sounds really simple, but I've been at it for days now trying to troubleshoot the exact problem. So what'll happen is that user will:
Click an image;
The image will be saved to the user's External Storage;
The image's Uri will be taken;
An ImageView will open the image with this Uri;
No image appeared, throws java.io.FileNotFoundException: /storage/emulated/....jpg: open failed: ENOENT (No such file or directory).
So I thought I didn't really pass the correct Uri and tried to troubleshoot from there. Then I accidentally rotated the screen and hey - my image is there! The the log file showed this when I rotated it a few times:
android.graphics.Bitmap#49361a20
android.graphics.Bitmap#495c42c8
android.graphics.Bitmap#496ac1e0
android.graphics.Bitmap#495b2b28
Is this displaying the memory location? Is it supposed to be different even after screen rotation?
With this information, is there anywhere else I should look into to solve this problem? I could rule out that the Uri is invalid, as it is showing the correct image after rotating the screen.
This is the code (of a utility class) involved to download the image clicked;
This method seems to work well and the image is saved to the correct directory.
public void downloadFile(String url) {
File folder = new File(Environment.getExternalStorageDirectory() + directory);
String fileName = url.substring(url.lastIndexOf("/") + 1);
String filePath = folder.getPath() + "/" + fileName;
File file = new File(filePath);
fileUri = Uri.fromFile(file);
if (!folder.exists()) {
Log.i(TAG, "Worka folder is not found, creating one now");
folder.mkdir();
} else {
Log.i(TAG, "Worka folder is found");
if (file.exists()) {
Log.i(TAG, "Found a file with the same name, deleting/replacing it now");
file.delete();
}
}
DownloadManager downloadManager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
Uri downloadUri = Uri.parse(url);
DownloadManager.Request request = new DownloadManager.Request(downloadUri);
request.setAllowedNetworkTypes(
DownloadManager.Request.NETWORK_MOBILE | DownloadManager.Request.NETWORK_WIFI)
//.setAllowedOverRoaming(false).setTitle("Roaming is not available")
.setDestinationInExternalPublicDir(directory, fileName);
downloadManager.enqueue(request);
Log.i(TAG, "downloadFile() is successful, " + fileName + " is saved to Worka directory");
}
public Uri getFilePath() {
return fileUri;
}
To make sure it gets passed from an activity to another activity;
FileDownload fileDownload = new FileDownload(getApplicationContext());
fileDownload.downloadFile(conversation.getMessage());
Uri fileUri = fileDownload.getFilePath();
if (fileUri != null) {
Log.i(TAG, "fileUri: " + fileUri.toString());
Intent intent = new Intent(BulletinPostActivity.this, ImageViewingActivity.class);
intent.putExtra("imageUri", fileUri.toString());
startActivity(intent);
Finally, getting Bitmap from the passed Uri:
I then tried using AsyncTask here, to make sure the bitmap gets loaded properly... but I'm unsure what to code to accomplish this.
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
...
String imagePath = getIntent().getStringExtra("imageUri");
imageUri = Uri.parse(imagePath);
touchImageView = (TouchImageView) findViewById(R.id.image_viewing_image_view);
if (imageUri != null) {
new loadBitmap(imageUri).execute();
}
}
public class loadBitmap extends AsyncTask<Void, Integer, Bitmap> {
Uri uri;
public loadBitmap(Uri uri) {
this.uri = uri;
}
#Override
protected Bitmap doInBackground(Void... params) {
getBitmap();
return bitmap;
}
public Bitmap getBitmap() {
try {
Log.i(TAG, "Attempting to get the bitmap from imageUri");
bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), imageUri);
Log.i(TAG, "Successfully gotten the bitmap from imageUri: " + bitmap);
} catch (IOException e) {
e.printStackTrace();
}
return bitmap;
}
#Override
protected void onPostExecute(Bitmap bitmap) {
if (bitmap == null) {
getBitmap();
} else {
touchImageView.setImageBitmap(bitmap);
}
}
}
Related
I have a custom listview which is working good, now i want to share the image and text from the list. I have found a step how to do it from SO but image is always null when i click on Share button.
The imageview loading images using Glide.
if (!Patterns.WEB_URL.matcher(Limage).matches()) {
viewholder.iview.setVisibility(View.GONE);
} else {
Glide.with(convertView.getContext()).load(Limage).centerCrop()
.diskCacheStrategy(DiskCacheStrategy.ALL).listener(new RequestListener<String, GlideDrawable>() {
#Override
public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
return false;
}
#Override
public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
// viewholder.progress.setVisibility(View.GONE);
return false;
}
}).into(viewholder.iview);
viewholder.iview.setVisibility(View.VISIBLE);
}
I have created a Share button and inside onclick i am passing the below code.
viewholder.share.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Uri bmpUri = getLocalBitmapUri(viewholder.iview);
if (bmpUri != null) {
// Construct a ShareIntent with link to image
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, bmpUri);
shareIntent.setType("image/*");
// Launch sharing dialog for image
listdisplay.startActivity(Intent.createChooser(shareIntent, "Share Image"));
} else {
// ...sharing failed, handle error
}
}
});
To get image from Imageview i am using the below code.
private Uri getLocalBitmapUri(ImageView iview) {
Drawable drawable = iview.getDrawable();
Bitmap bmp = null;
if (drawable instanceof BitmapDrawable){
bmp = ((BitmapDrawable) iview.getDrawable()).getBitmap();
Log.e("Shiva","Came inside drawable");
} else {
Log.e("Shiva","drawable is null"+drawable);
return null;
}
Uri bmpUri = null;
File file = new File(listdisplay.getExternalFilesDir(Environment.DIRECTORY_PICTURES), "share_image_" + System.currentTimeMillis() + ".png");
FileOutputStream out = null;
try {
out = new FileOutputStream(file);
bmp.compress(Bitmap.CompressFormat.PNG, 90, out);
out.close();
bmpUri = Uri.fromFile(file);
} catch (IOException e) {
e.printStackTrace();
}
// **Warning:** This will fail for API >= 24, use a FileProvider as shown below instead.
return bmpUri;
}
So, what happened now is in the if step where it is checking "drawable instanceof BitmapDrawable" is always returns null. whats wrong here?
Note: Above code are inside the adapter.
You can load image using this :
Glide.with(this)
.load("https://cdn-images-1.medium.com/max/1200/1*hcfIq_37pabmAOnw3rhvGA.png")
.asBitmap()
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.into(new SimpleTarget<Bitmap>() {
#Override
public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
Log.d("Size ", "width :"+resource.getWidth() + " height :"+resource.getHeight());
imageView.setImageBitmap(resource);
storeImage(resource);
}
});
And store bitmap to external storage and then share it.
private void storeImage(Bitmap image) {
File pictureFile = getOutputMediaFile();
if (pictureFile == null) {
Log.d(TAG,
"Error creating media file, check storage permissions: ");// e.getMessage());
return;
}
try {
FileOutputStream fos = new FileOutputStream(pictureFile);
image.compress(Bitmap.CompressFormat.PNG, 90, fos);
fos.close();
Log.d(TAG, "img dir: " + pictureFile);
} catch (FileNotFoundException e) {
Log.d(TAG, "File not found: " + e.getMessage());
} catch (IOException e) {
Log.d(TAG, "Error accessing file: " + e.getMessage());
}
}
private File getOutputMediaFile(){
// To be safe, you should check that the SDCard is mounted
// using Environment.getExternalStorageState() before doing this.
File mediaStorageDir = new File(Environment.getExternalStorageDirectory()
+ "/Android/data/"
+ getApplicationContext().getPackageName()
+ "/Files");
if (! mediaStorageDir.exists()){
if (! mediaStorageDir.mkdirs()){
return null;
}
}
File mediaFile;
Random generator = new Random();
int n = 1000;
n = generator.nextInt(n);
String mImageName = "Image-"+ n +".jpg";
mediaFile = new File(mediaStorageDir.getPath() + File.separator + mImageName);
return mediaFile;
}
iview.getDrawable() will return null when using Glide.
You can set:
public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
viewholder.iview.setDrawable(resource);
return true;
}
then iview.getDrawable() will return drawable
// Pass the Activity Context, ImageView, Image path which is located inside sdcard,And default Image you want to display to
loadImageWithGlide Method.
loadImageWithGlide(this,imageView,imagePath,R.drawable.damaged_image,R.drawable.damaged_image);
// Method to Load Image from Sdcard to ImageView With Using Glide Library
public static void loadImageWithGlide(final Context context, ImageView theImageViewToLoadImage,
String theLoadImagePath, int theDefaultImagePath, int tehErrorImagePath) {
if (context == null) return;
Glide.with(context) //passing context
.load(theLoadImagePath) //passing your url to load image.
.placeholder(theDefaultImagePath) //this would be your default image (like default profile or logo etc). it would be loaded at initial time and it will replace with your loaded image once glide successfully load image using url.
.error(tehErrorImagePath)//in case of any glide exception or not able to download then this image will be appear . if you won't mention this error() then nothing to worry placeHolder image would be remain as it is.
.diskCacheStrategy(DiskCacheStrategy.ALL) //using to load into cache then second time it will load fast.
//.animate(R.anim.fade_in) // when image (url) will be loaded by glide then this face in animation help to replace url image in the place of placeHolder (default) image.
.fitCenter()//this method help to fit image into center of your ImageView
.into(theImageViewToLoadImage); //pass imageView reference to appear the image.
}
// Bellow is Code to share Image
// Note: The image needed to located inside Sdcard. Pass that path inside Share Method.
public static void share(Context theCtx, String theImagePath, String theText) {
File myImageFile = new File(theImagePath);
String shareBody = theText; //"Here is the share content body " ;
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
if (myImageFile.exists()) {
sharingIntent.setType("image/jpeg");
sharingIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + myImageFile.getAbsolutePath()));
} else if (!theText.isEmpty()) {
sharingIntent.setType("text/*");
}
sharingIntent.putExtra(Intent.EXTRA_SUBJECT, ""); //"Subject here"
sharingIntent.putExtra(Intent.EXTRA_TEXT, shareBody);
sharingIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
theCtx.startActivity(Intent.createChooser(sharingIntent, "Share via"));
}
You need to create a cache in memory with your image than you can extract it, otherwise is null, may be destroyed.
imageView.setDrawingCacheEnabled(true);
imageView.buildDrawingCache();
Bitmap bitmap = imageView.getDrawingCache();
In my application ImageTakerActivity creates MediaStore.ACTION_IMAGE_CAPTURE intent to capture image.
I specified the following URI as MediaStore.EXTRA_OUTPUT. So its expected that ACTION_IMAGE_CAPTURE will write the taken photo to the corresponding file represented in the URI.
/******** ImageTakerActivity *********/
private void captureImage()
{
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
fileUri = getOutputMediaFileUri();
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);
takePictureIntent.putExtra(MediaStore.EXTRA_FULL_SCREEN, true);
if (takePictureIntent.resolveActivity(getPackageManager()) != null)
{
startActivityForResult(takePictureIntent, REQUEST_CODE_TAKE_IMAGE);
}
}
public Uri getOutputMediaFileUri()
{
return Uri.fromFile(getOutputMediaFile());
}
private File getOutputMediaFile()
{
// External sdcard location
File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),IMAGE_DIRECTORY_NAME);
//Deleting previous Images
if(mediaStorageDir.exists())
{
DeleteRecursive(mediaStorageDir);
}
// Create the storage directory if it does not exist
if (!mediaStorageDir.exists())
{
if (!mediaStorageDir.mkdirs())
{
Log.d(IMAGE_DIRECTORY_NAME, "Oops! Failed create " + IMAGE_DIRECTORY_NAME + " directory");
return null;
}
}
// Create a media file name
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmssSSS",Locale.getDefault()).format(new Date());
File mediaFile = new File(mediaStorageDir.getAbsolutePath() + File.separator + "IMG_" + timeStamp + ".jpg");
return mediaFile;
}
In ActivityResult I did the following to retrieve the saved image:
private void decodeImageStream()
{
InputStream stream = null;
try
{
//this fileUri was passed to the takePictureIntent
stream = getContentResolver().openInputStream(fileUri);
image = BitmapFactory.decodeStream(stream);
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
finally
{
if(stream != null)
{
try
{
stream.close();
}
catch (IOException ex)
{
ex.printStackTrace();
}
}
}
}
Most of the time expected image is successfully decoded in image variable.
But sometimes after taking the picture when i tap OK, whole screen does a quick rotation and becomes black. After returning to onActivityResult of ImageTakerActivity, I get nothing in the image variable! Also there is no Exception on BitmapFactory.decodeStream too.
I have tried reading various articles available, but I don't know how to resolve the issue. Any help is very much appreciated!
In My app I am taking picture and I am successfully saving it in the gallery after compressing it. Now I want to show it into other activity, so that user can share it or view it at least. So How can I do that.
Following is my code which is saving picture and just after saving it, it shows ad , and on the adClosed event I want to send that taken picture to other activity , How Can I do that. My code just goes like this ..
File storagePath = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+ File.separator + "MyAnimals");
storagePath.mkdirs();
String finalName = Long.toString(System.currentTimeMillis());
//this snippet is saving image And I am showing ad after saving picture
File myImage = new File(storagePath, finalName + ".jpg");
String photoPath = Environment.getExternalStorageDirectory().getAbsolutePath() +"/" + finalName + ".jpg";
try {
FileOutputStream fos = new FileOutputStream(myImage);
newImage.compress(Bitmap.CompressFormat.JPEG, 100, fos);
fos.close();
//refreshing gallery
Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
mediaScanIntent.setData(Uri.fromFile(myImage));
sendBroadcast(mediaScanIntent);
} catch (IOException e) {
Toast.makeText(this, "Pic not saved", Toast.LENGTH_SHORT).show();
return;
}
Toast.makeText(this, "Pic saved in: " + photoPath, Toast.LENGTH_SHORT).show();
displayInterstitial();
interstitial.setAdListener(new AdListener() {
#Override
public void onAdClosed() {
Log.v("Add time");
Intent intent = new Intent(CameraActivity.this,ShowCapturedImage.class);
//Now How to send the saved picture to the image view of other activity?
startActivity(intent);
super.onAdClosed();
}
});
1) put taken image path in intent
2) get path in other activity and set it in imageview
public static final int REQUEST_CODE_FROM_CAMERA = 112;
private Uri fileUri;
String image_path = "";
//Catch image from below function
private void fromCamera() {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE);
Log.d("FROM CAMERA CLICKED file uri", fileUri.getPath());
intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);
// start the image capture Intent
startActivityForResult(intent, REQUEST_CODE_FROM_CAMERA);
}
//On Activity result store image path
#Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CODE_FROM_CAMERA
&& resultCode == Activity.RESULT_OK) {
try {
image_path = fileUri.getPath();
} catch (NullPointerException e) {
e.printStackTrace();
}
}
}
On Click of any button
Intent iSecond=new Intent(FirstActivity.this,SecondActivity.class);
iSecond.putExtra("image_path",image_path);
startActivity(iSecond);
In Second Activity onCreate()
Bundle extras = intent.getExtras();
if(extras != null)
String image_path = extras.getString("image_path");
From this image path , You can get image and set to imageview
ImageView iv;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
iv = (ImageView) findViewById(R.id.imageView1);
File imgFile = new File("/storage/emulated/0/1426484497.png");
if (imgFile.exists()) {
Bitmap myBitmap = BitmapFactory.decodeFile(imgFile
.getAbsolutePath());
iv.setImageBitmap(myBitmap);
}
}
You can do this by adding a ImageView to your Activity.
A simple ImageView should look like this:
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/imageView" />
Then you capture it in your Activity class
ImageView imageView = (ImageView) this.findViewById(R.id.imageView);
Now the fun part. We'll capture your image using the image URI and parse it in a bitmap.
Bitmap bitmap = BitmapFactory.decodeFile(fileUri.getPath()); //Here goes your image path
imageView.setImageBitmap(Bitmap.createScaledBitmap(bitmap,imageView.getWidth(), imageView.getHeight(), false)); //I scale the bitmap so it show properly. If the image is too big, it wont show on the ImageView
That should do the trick, tell me if it works!
I am trying to get an image taken from the camera, and storing it locally in a cache to preview in an ImageView and upload to a server when needed. The bitmap that I get back is null.
Below is my code:
#Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_IMAGE_CAPTURE){
if (resultCode == RESULT_OK){
// TODO - save the full sized image as well
if(mCurrentPhotoPath!=null){
Log.i(TAG, "Image File found!");
Bitmap imageBitmap = BitmapFactory.decodeFile(mCurrentPhotoPath);
if (imageBitmap !=null){
Log.i(TAG, "Successfully retrieved image back.");
}
ImageView postImageView= (ImageView) getActivity().findViewById(R.id.post_image);
postImageView.setImageBitmap(imageBitmap);
}
}
}
}
String mCurrentPhotoPath;
private File createImageCache(Context context) throws IOException {
// Create an image file name
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
String imageFileName = "JPEG_" + timeStamp + "_";
File storageDir = context.getCacheDir();
Log.i(TAG, "StorageDir: "+storageDir);
File image = File.createTempFile(
imageFileName, /* prefix */
".jpg", /* suffix */
storageDir /* directory */
);
// Save a file: path for use with ACTION_VIEW intents
mCurrentPhotoPath = image.getAbsolutePath();
return image;
}
Searching around one of the solutions that I found and tried was setting the BitmapFactory.Options, but it didn't work for my case.
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
Edit: Ran getActivity().getCacheDir().list() and found that the files are indeed saved. Also, here is the button that saves the images:
button.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (cameraIntent.resolveActivity(getActivity().getPackageManager())!=null){
// Create the File where the photo should go
File photoFile = null;
try {
photoFile = createImageCache(getActivity());
} catch (IOException ex) {
// Error occurred while creating the File
Log.i(TAG, "Error Creating File!!! No Space??");
}
// Continue only if the File was successfully created
if (photoFile != null) {
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT,
Uri.fromFile(photoFile));
startActivityForResult(cameraIntent, REQUEST_IMAGE_CAPTURE);
}
}else{
Toast.makeText(getActivity(),"Please check your camera", Toast.LENGTH_SHORT).show();
Log.i(TAG, "No camera to run");
}
}
});
and found that the files are indeed saved. Just a list() will not prove that. You created the files yourself so they were there already with length 0. What is the length in bytes afterwards? I think still 0. getCacheDir() delivers internal private memory unreachable for the external picture taker. Try with getExternalCacheDir() instead.
I'm building an Android app that takes a picture and then immediately goes to a crop screen. I couldn't figure out how to pass the image without downgrading it (i.e. if i was to put it in a Bundle), so I just decided to save the image and pull it back off the card.
Right now when I'm trying to get the image back in the new crop_view, which comes right after the camera_view, the app throws a Null Pointer Exception on the line indicated in the code below. The image is actually being set at Pictures/MyApp/IMG_APP.jpg where "Pictures" is my default picture directory.
public Bitmap getImage() {
Bitmap toReturn = null;
File root = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
ImageView IV = (ImageView) findViewById(R.id.crop_view);
toReturn = BitmapFactory.decodeFile(root+"/MyApp/IMG_APP.jpg");
IV.setImageBitmap(toReturn);
return toReturn;// TODO Fix this line. It is breaking here with a null pointer exception.
}
Below this is the code where the picture is being saved. I have confirmed that it is being saved by checking on the actual sd card in another app.
void onPictureJpeg(byte[] bitmapdata, Camera camera) {
int i = bitmapdata.length;
Log.d(TAG, String.format("bytes = %d", i));
File f = IMGP_Photo_Handler.generateTimeStampPhotoFile();
try {
OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(f));
outputStream.write(bitmapdata);
outputStream.flush();
outputStream.close();
exceptionCaught = false;
} catch (Exception e) {
Log.e(TAG, "Error accessing photo output file:" + e.getMessage());
Toast
.makeText(IMGP_Camera.this, "Cannot save file. \nPlease mount an external SD Card", Toast.LENGTH_LONG)
.show();
exceptionCaught = true;// To get this to not start the next intent if the file save doesn't work.
}
if(!exceptionCaught){
sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED,
Uri.parse("file://" + Environment.getExternalStorageDirectory())));
Intent intent = new Intent();
intent.setClass(IMGP_Camera.this, IMGP_Crop.class);
intent.putExtra("po","3265695");
startActivity(intent);
}
finish();
}
And then finally my photo_handler:
public static Uri photoFileUri = null;
public static File getPhotoDirectory() {
File outputDir = null;
String externalStorageState = Environment.getExternalStorageState();
if (externalStorageState.equals(Environment.MEDIA_MOUNTED)) {
File pictureDir =
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
outputDir = new File(pictureDir, "MyApp");
if(!outputDir.exists()) {
if(!outputDir.mkdirs()) {
String message = "Failed to create directory:" + outputDir.getAbsolutePath();
Log.e(TAG, message);
outputDir = null;
}
}
}
return outputDir;
}
public static File generateTimeStampPhotoFile() {
File photoFile = null;
File outputDir = getPhotoDirectory();
if (outputDir != null) {
String photoFileName = "IMG_APP.jpg";
photoFile = new File(outputDir, photoFileName);
}
return photoFile;
}
public static Uri generateTimeStampPhotoFileUri() {
photoFileUri = null;
File photoFile = generateTimeStampPhotoFile() ;
if (photoFile != null) {
photoFileUri = Uri.fromFile(photoFile);
}
return photoFileUri;
}
public static Uri getFile(){
return photoFileUri;
}
I fixed this by passing the path to the photo and uri in an extra:
String photoFileName = "IMG_TQL.jpg";
photoFile = new File(outputDir, photoFileName);
photoFilePath = photoFile.getAbsolutePath();
Intent intent = new Intent();
intent.setClass(IMGP_Camera.this, IMGP_Crop.class);
intent.putExtra("path", path);
intent.putExtra("uri", uri);
startActivity(intent);