I need to push an intent to default camera application to make it take a photo, save it and return an URI. Is there any way to do this?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
Try the following I found here
try this code
It took me some hours to get this working. The code it's almost a copy-paste from developer.android.com, with a minor difference.
Request this permission on the
AndroidManifest.xml
:On your
Activity
, start by defining this:Then fire this
Intent
in anonClick
:Add the following support method:
Then receive the result:
What made it work is the
MediaStore.Images.Media.getBitmap(this.getContentResolver(), Uri.parse(mCurrentPhotoPath))
, which is different from the code from developer.android.com. The original code gave me aFileNotFoundException
.Try the following I found Here's a link
If your app targets M and above and declares as using the CAMERA permission which is not granted, then attempting to use this action will result in a SecurityException.
EasyImage.openCamera(Activity activity, int type);
I found a pretty simple way to do this. Use a button to open it using an
on click
listener to start the functionopenc()
, like this:You can do whatever you want with the
uri
location string. For instance, I send it to an image cropper to crop the image.