历览千载书,时时见遗烈。这篇文章主要讲述如何保存安卓系统中摄像头点击的图片?相关的知识,希望能为你提供帮助。
我正在开发一个联系人应用程序。为了添加联系人图片,我给出了一个对话框,其中显示了以下2个选项-&
gt。
1:拍摄一张新图片
2:从内存中选择一张图片
当我使用第1个选项时,相机点击的图片没有被保存。我在logcat中得到这个信息。我该怎么做才能保存摄像机点击的图片?
` E/ImageLoader: Permission Denial: opening provider com.android.providers.media.MediaDocumentsProvider from ProcessRecord{417788c 11498:com.example.contactslist/u0a273} (pid=11498, uid=10273) requires that you obtain access using ACTION_OPEN_DOCUMENT or related APIs
java.lang.SecurityException: Permission Denial: opening provider com.android.providers.media.MediaDocumentsProvider from ProcessRecord{417788c 11498:com.example.contactslist/u0a273} (pid=11498, uid=10273) requires that you obtain access using ACTION_OPEN_DOCUMENT or related APIs
at android.os.Parcel.createException(Parcel.java:1953)
at android.os.Parcel.readException(Parcel.java:1921)
at android.os.Parcel.readException(Parcel.java:1871)
at android.app.IActivityManager$Stub$Proxy.getContentProvider(IActivityManager.java:4087)
at android.app.ActivityThread.acquireProvider(ActivityThread.java:6106)
at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider(ContextImpl.java:2616)
at android.content.ContentResolver.acquireUnstableProvider(ContentResolver.java:1844)
at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1457)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1310)
at android.content.ContentResolver.openInputStream(ContentResolver.java:1030)
at com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStreamFromContent(BaseImageDownloader.java:225)
at com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStream(BaseImageDownloader.java:92)
at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.downloadImage(LoadAndDisplayImageTask.java:291)
at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryCacheImageOnDisk(LoadAndDisplayImageTask.java:274)
at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryLoadBitmap(LoadAndDisplayImageTask.java:230)
at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.run(LoadAndDisplayImageTask.java:136)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)2020-05-25 21:15:51.603 11498-11648/com.example.contactslist E/ImageLoader: UIL doesn't support scheme(protocol) by default [null]. You should implement this support yourself (BaseImageDownloader.getStreamFromOtherSource(...))
java.lang.UnsupportedOperationException: UIL doesn't support scheme(protocol) by default [null]. You should implement this support yourself (BaseImageDownloader.getStreamFromOtherSource(...))
at com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStreamFromOtherSource(BaseImageDownloader.java:280)
at com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStream(BaseImageDownloader.java:99)
at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.downloadImage(LoadAndDisplayImageTask.java:291)
at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryCacheImageOnDisk(LoadAndDisplayImageTask.java:274)
at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryLoadBitmap(LoadAndDisplayImageTask.java:230)
at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.run(LoadAndDisplayImageTask.java:136)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
`
答案要访问摄像机,您需要从棒棒糖操作系统开始获得摄像机的权限。
要访问相机,首先要在您的清单文件中添加这一行。
<
manifest ... >
<
uses-feature android:name="android.hardware.camera"
android:required="true" />
...
【如何保存安卓系统中摄像头点击的图片()】按照这个链接获取完整的代码。https:/developer.android.comtrainingcameraphotobasics#TaskManifest。
推荐阅读
- 中断的AVD系统路径。检查您的ANDROID_SDK_ROOT值
- Android上的BLE(蓝牙低功耗蓝牙),创建并重新连接到并不总是存在的设备
- 如何修复mapreduce中mapper的setup方法给出的字符串值的不规则行为()
- 无法增加Max Application Master资源
- (Zeppelin + Livy)SparkUI.appUIAddress(),一定是错的
- Winform Application UI在其他打开的应用程序之间切换时冻结
- Android Place自动填充片段(无法设置文字)
- 如何在Android上的Kotlin中从Long类型变量中提取日期和时间
- 如何在Dapper.Net中编写一对多查询()