我创建了一个应用程序,将意图发送到相机应用程序以拍照。
if (storageState.equals(Environment.MEDIA_MOUNTED)) {
try {
String name= "pic"+new Date().getTime();
File photoFile = File.createTempFile(name, ".jpg");
Log.i(TAG, "created file:"+name+".jpg");
mImageUri = Uri.fromFile(photoFile);
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, mImageUri);
startActivityForResult(takePictureIntent, ActionCode.TAKE_PHOTO);
} catch (IOException e) {
Log.e(TAG, "Could not create file. ", e);
}
}
当我拍照并按“勾选”确定按钮时。它不会向我的应用程序发送任何结果。
我在 logcat 中发现了这个错误。
07-22 17:56:30.289: E/iu.UploadsManager(5699): upload failed for ID=11 content_uri=content://media/external/images/media/5117 state=1 bytes_total=0,0%
07-22 17:56:30.289: E/iu.UploadsManager(5699): java.lang.IllegalArgumentException: Zero length file can't be uploaded
07-22 17:56:30.289: E/iu.UploadsManager(5699): at com.google.android.apps.plus.iu.GDataUploader.upload(GDataUploader.java:95)
07-22 17:56:30.289: E/iu.UploadsManager(5699): at com.google.android.apps.plus.iu.UploadsManager.doUpload(UploadsManager.java:819)
07-22 17:56:30.289: E/iu.UploadsManager(5699): at com.google.android.apps.plus.iu.UploadsManager.access$1200(UploadsManager.java:54)
07-22 17:56:30.289: E/iu.UploadsManager(5699): at com.google.android.apps.plus.iu.UploadsManager$UploadTask.performSyncInternal(UploadsManager.java:1390)
07-22 17:56:30.289: E/iu.UploadsManager(5699): at com.google.android.apps.plus.iu.UploadsManager$AutoUploadTask.performSyncInternal(UploadsManager.java:1874)
07-22 17:56:30.289: E/iu.UploadsManager(5699): at com.google.android.apps.plus.iu.UploadsManager$UploadTask.performSync(UploadsManager.java:1309)
07-22 17:56:30.289: E/iu.UploadsManager(5699): at com.google.android.apps.plus.iu.InstantUploadSyncManager.performSyncInternal(InstantUploadSyncManager.java:545)
07-22 17:56:30.289: E/iu.UploadsManager(5699): at com.google.android.apps.plus.iu.InstantUploadSyncManager.performSync(InstantUploadSyncManager.java:591)
07-22 17:56:30.289: E/iu.UploadsManager(5699): at com.google.android.apps.plus.iu.InstantUploadSyncService$InstantUploadSyncAdapter.onPerformSync(InstantUploadSyncService.java:180)
07-22 17:56:30.289: E/iu.UploadsManager(5699): at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:254)