You can use Magical Take Photo library.
1. try with compile 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. instance the class like this
// "this" is the current activity param
MagicalTakePhoto magicalTakePhoto = new MagicalTakePhoto(this,ANY_INTEGER_0_TO_4000_FOR_QUALITY);
4. if you need to take picture use the method
magicalTakePhoto.takePhoto("my_photo_name");
5. if you need to select picture in device, try with the method:
magicalTakePhoto.selectedPicture("my_header_name");
6. You need to override the method onActivityResult of the activity or fragment like this:
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
magicalTakePhoto.resultPhoto(requestCode, resultCode, data);
// example to get photo
// imageView.setImageBitmap(magicalTakePhoto.getMyPhoto());
}
Note: Only with this Library you can take and select picture in the device, this use a min API 15.