Android Camera Photo Take Filenotfoundexception
ORIGINAL :In my application i am calling native camera from code, my intent to take a picture from camera and get its file path also show it in the image view. code below is callin
Solution 1:
i have changed my perspective to this problem , simple is the better
in some global
int TAKE_PHOTO_CODE = 1888;
in buttononclick or where you call the camera intent
IntentcameraIntent=newIntent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, TAKE_PHOTO_CODE);
in the onActivityResult
if (requestCode == TAKE_PHOTO_CODE && resultCode == RESULT_OK) {
if(data != null)
{
Uri selectedImageUri = data.getData();
String filestring = selectedImageUri.getPath();
Bitmap bm = (Bitmap) data.getExtras().get("data");
bmpPhoto = bm;
bmpPhotoPath =filestring;
imageView.setImageBitmap(bmpPhoto);
removePhoto.setVisibility(View.VISIBLE);
}}
Solution 2:
FileoutputDir= context.getCacheDir(); // context being the Activity pointerFileoutputFile= File.createTempFile("prefix", "extension", outputDir);
Try this method create your temp file.
Post a Comment for "Android Camera Photo Take Filenotfoundexception"