Update for the Camera Application
In this document, we will show you how to use a 3rd Party library to crop images, since some of you might encounter errors in using the default code.
Here are the steps that you need to follow to get the camera and crop running in your projects.
Under Gradle Scripts, goto build.gradle (Module:app)
Add this line in the dependencies, basically here we are asking Android Studio to include this library for us, instead of manually adding files. -
compile 'com.soundcloud.android:android-crop:1.0.1@aar'
It should look something like this-
Open the manifests file-
Make sure you have the necessary permissions added. Since the app will be accessing the camera, and the library we used needs to access the temporary image clicked by the android camera for cropping, we add the following permissions-
Also since we are using a library for cropping images we click, we need to add the ¡®Cropping Activity¡¯ of the library into our manifest, which tells android that our app can open that activity. This is how it would look. Please notice that after the </activity> tag (i.e. where we declare the activity made in our app), we declare the 3rd party activity that our app will be using.
Finally,
Goto CameraControlActivity and import the crop functionality of the library.
Now you are all set to use the 3rd party library to crop the images in your activity.