You can use the Magical Take Photo library.
1. try compiling in gradle
compile 'com.frosquivel:magicaltakephoto:1.0'
2. You need this permission in your manifest. Xml
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.CAMERA"/>
3. an instance of a class like this
// "this" is the current activity parameter
MagicalTakePhoto magicalTakePhoto = new MagicalTakePhoto(this,ANY_INTEGER_0_TO_4000_FOR_QUALITY);
4. if you need to take a picture, use the method
magicalTakePhoto.takePhoto("my_photo_name");
5. if you need to select an image on the device, try using the method:
magicalTakePhoto.selectedPicture("my_header_name");
6. You need to override the onActivityResult method of the activity or fragment as follows:
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); magicalTakePhoto.resultPhoto(requestCode, resultCode, data);
Note. Only in this library can you select and select an image on the device using the min API 15.
fabian7593 May 16 '16 at 10:54 pm 2016-05-16 22:54
source share