Get URI of a full size photo by Camera in OnActivityResult

2

I'm using the Android camera to take a photo and save it from a WebService. I was able to do this, however using the method of taking a thumbnail. My intention is to get the image in full size.

I researched a lot and got to the official Android website. link

So, on my take the photo button I called the dispatchTakePictureIntent method, as it has on the official website and also created the createImageFile () method, as shown below.

static final int REQUEST_TAKE_PHOTO = 1;

private void dispatchTakePictureIntent() {
    Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    // Ensure that there's a camera activity to handle the intent
    if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
        // Create the File where the photo should go
        File photoFile = null;
        try {
            photoFile = createImageFile();
        } catch (IOException ex) {
            // Error occurred while creating the File
            ...
        }
        // Continue only if the File was successfully created
        if (photoFile != null) {
            takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT,
                    Uri.fromFile(photoFile));
            startActivityForResult(takePictureIntent, REQUEST_TAKE_PHOTO);
        }
    }
}

String mCurrentPhotoPath;

private File createImageFile() throws IOException {
    // Create an image file name
    String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
    String imageFileName = "JPEG_" + timeStamp + "_";
    File storageDir = Environment.getExternalStoragePublicDirectory(
            Environment.DIRECTORY_PICTURES);
    File image = File.createTempFile(
        imageFileName,  /* prefix */
        ".jpg",         /* suffix */
        storageDir      /* directory */
    );

    // Save a file: path for use with ACTION_VIEW intents
    mCurrentPhotoPath = "file:" + image.getAbsolutePath();
    return image;
}

Quiet. But my intention now is to get the result in OnActivityResult and, following the official google tutorial, it was not clear to me which code I put in OnActivityResult (the code that has there activityresult is for the thumbnail.)

I have seen some codes on the internet, but many have taken the URI thumbnail. I want to get the full OnActivityResult.

I have seen the setPic and galleryAddPic methods on the site, but I do not know where to apply it.

Can anyone help which code I enter in the OnActivityResult?

    
asked by anonymous 18.01.2016 / 16:06

0 answers