三星Galaxy J5不保存或读取图像

时间:2016-04-28 11:40:09

标签: android

我在Samsung Galaxy J5设备上遇到问题

它总是给我一个错误,当尝试从相机拍摄图像时无法保存图像,当尝试从URI加载图像时我得到了异常

以下是我试图打开的URII的示例

file:///storage/emulated/0/DCIM/Tango/image.jpg

这是我得到的例外

E/MediaStore: Failed to insert image
java.io.FileNotFoundException: No such file or directory
at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:146)
at android.content.ContentProviderProxy.openAssetFile(ContentProviderNative.java:620)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:943)
at android.content.ContentResolver.openOutputStream(ContentResolver.java:690)
at android.content.ContentResolver.openOutputStream(ContentResolver.java:666)
at android.provider.MediaStore$Images$Media.insertImage(MediaStore.java:961)
at com.forsale.forsale.controller.manager.ForSaleServerManager.getImageUri(ForSaleServerManager.java:3641)
at com.forsale.forsale.controller.manager.ForSaleServerManager.getFileObject(ForSaleServerManager.java:3627)
at com.forsale.forsale.controller.manager.ForSaleServerManager$33.doInBackground(ForSaleServerManager.java:2514)
at com.forsale.forsale.controller.manager.ForSaleServerManager$33.doInBackground(ForSaleServerManager.java:2492)
at android.os.AsyncTask$2.call(AsyncTask.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)

java.lang.NullPointerException: uriString
at android.net.Uri$StringUri.<init>(Uri.java:471)
at android.net.Uri$StringUri.<init>(Uri.java:461)
at android.net.Uri.parse(Uri.java:433)
at com.forsale.forsale.controller.manager.ForSaleServerManager.getImageUri(ForSaleServerManager.java:3642)
at com.forsale.forsale.controller.manager.ForSaleServerManager.getFileObject(ForSaleServerManager.java:3627)
at com.forsale.forsale.controller.manager.ForSaleServerManager$33.doInBackground(ForSaleServerManager.java:2514)
at com.forsale.forsale.controller.manager.ForSaleServerManager$33.doInBackground(ForSaleServerManager.java:2492)
at android.os.AsyncTask$2.call(AsyncTask.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.io.File.getName()' on a null object reference
at com.forsale.forsale.controller.manager.MultipartUtility.addFilePart(MultipartUtility.java:54)
at com.forsale.forsale.controller.manager.ForSaleServerManager$33.doInBackground(ForSaleServerManager.java:2515)
at com.forsale.forsale.controller.manager.ForSaleServerManager$33.doInBackground(ForSaleServerManager.java:2492)
at android.os.AsyncTask$2.call(AsyncTask.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)

1 个答案:

答案 0 :(得分:0)

您必须先检查您的路径。如果它是正确的,那么寻找图像命名为&#39; image.jpg&#39;。这可能会解决问题。