Get Error when capture image

前端 未结 2 1897
傲寒
傲寒 2021-01-29 03:55

I want to capture image using camera and want image path.

I try following code but I get Error. (I follow this link Get Path of image from ACTION_IMAGE_CAPTURE Intent)

2条回答
  •  借酒劲吻你
    2021-01-29 04:14

    if (resultCode != RESULT_CANCELED) {
        if (requestCode == CAMERA_REQUEST) {
    
         String[] projection = { MediaStore.Images.Media.DATA };
          Cursor cursor = managedQuery(mCapturedImageURI, projection,                   null, null, null);
                    int column_index_data = cursor
                            .getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
                    cursor.moveToFirst();
                    String capturedImageFilePath = cursor
                            .getString(column_index_data);
    
                    Toast.makeText(getApplicationContext(),
                            capturedImageFilePath.toString(), Toast.LENGTH_LONG)
                            .show();
    
                }
            }
    

    you try this one i think they will help you..

提交回复
热议问题