I have to apologize in advance if this snippet is not thorough enough, it has several issues. By example, creating a new file and using Picasso could be improve, by creating a reduced size version of that file and setting it directly in to the UI.
I strongly recommend to simply use MagicalCamera, is really magical. Read this, then go a head, you can compare.
Also there are a big problems not taking into consideration here. First, this doesnt add the photo in to the gallery. Android gallery must receive an intent of the photo to add it, this is pending for now. And second, the orientation of the photo is not taken in consideration, this is not a minor issue cause there are several disparities in orientation metada across devices.
If you are having problems with getting the full size photo from camera this should help you.
In case you are wondering why is there a PhotoData.java file, it is because orientation changes can reset the variables in the Activity. At first I used to rely on the configChanges being resilient to orientation changes (the Activity attribute in AndroidManfest.xml), but with time, I rather to be safe than sorry. The SharedPreference will include the uri from the photo we need, this way is persistent.
- In your Activity find the views you will use, in this case a button for the camera intent, another for the gallery, and an ImageView for showing the picture.
- There is a second file that handles the data, like file creation and uri from the photo, create it
- The camera intent what does is to create a file using the aux class, then pass the uri to the intent and save it using the aux file
- When the user is return the onActivityResult method will directly put the photo in the UI cause the uri is saved allready
- If the intent is to the gallery, the first thing done in onActivityResult is to get the uri from the selected photo
- Then that uri is saved to the method
- And the image can be set in the UI
- Please dont forget to add the needed permissions in the AndroidManifest.xml (see manifest_tweak.xml file)
- And by all means include the configuration for the Activity as shown in the manifest_tweak.xml file