how to get image name using camera intent in android? -
I want to take the current image of the camera using this code. I can get the image from the camera and display it in the image view. I want to know the file name of that image
Intent Intent = New Intent (android.provider.MediaStore.ACTION_IMAGE_CAPTURE); StartActivityForResult (intent, CAMERA_PIC_REQUEST); Public Zero (Int Request Code, Ink Results, Code, Intent Data) on Active Result {super.onActivityResult (requestCode, Resultscode, Data); Switch (requestcode) {case 2: {if (resultCode == RESULT_OK) {bitmap thumbnail = (bitmap) data.getExtras (). Get ("data"); Mg_view.setImageBitmap (thumbnail); } break;
Post-text "itemprop =" text "> In your activity ( Which is called YourActivity ): public static id TAKE_IMAGE = 111; Uri Mkeptide ImageURI; Call a camera anywhere !
try {string fileName = "temp.jpg"; content values = new content value (); Values.put (MediaStore.Images.Media.TITLE, filename); MCapturedImageURI = getContentResolver ( ) .inert (MediaStore.media.media.exterNAL_CONTENT_URI, value); intended intent = new intent (mediastore.action_ia UNCUCCT); Intent.putExtra (MediaStore. EXTRA_OUTPUT, mCapturedImageURI); StartActivityForResult (intent, TAKE_IMAGE);} hold (exception e) {Log.e ("", "", e);} Now in the outcome of the activity (notice capturedImageFilePath ) Active integration at intersection (int requestCode, int resultCode, intent intent) {If ((requestcode == Your Activity.TAKE_IMAGE) & amp; amp; (resultcode == RESULT_OK)) {mode = MODE_VIEWER; String [] projection = {MediaStore.images.Media.DATA}; Cursor cursor = managed (mCapturedImageURI, projection, blank, empty, empty); Int column_index_data = Cursor .getColumnIndexOrThrow (MediaStore.Images.Media.DATA); Cursor.moveToFirst (); // This is what you want! String capture image file path = cursor.gate string (column_index_data); Bitmap = bitmapfireter diskcode file (capitimate file path); }}
Comments
Post a Comment