public void startCamera() {
Log.d("TDM_CAMERA", "Starting camera on the phone...");
String fileName = "testphoto.jpg";
ContentValues values = new ContentValues();
values.put(MediaStore.Images.Media.TITLE, fileName);
values.put(MediaStore.Images.Media.DESCRIPTION,
"Image capture by camera");
values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg");
imageUri = getContentResolver().insert(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
startActivityForResult(intent, 1337);
}
log cat 在 imageUri = getContentResolver().this line 中显示错误
02-08 07:32:11.505: E/AndroidRuntime(2136): FATAL EXCEPTION: main
02-08 07:32:11.505: E/AndroidRuntime(2136): java.lang.UnsupportedOperationException: Unknown URI: content://media/external/images/media
02-08 07:32:11.505: E/AndroidRuntime(2136): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:169)
02-08 07:32:11.505: E/AndroidRuntime(2136): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:137)
02-08 07:32:11.505: E/AndroidRuntime(2136): at android.content.ContentProviderProxy.insert(ContentProviderNative.java:420)
02-08 07:32:11.505: E/AndroidRuntime(2136): at android.content.ContentResolver.insert(ContentResolver.java:866)
02-08 07:32:11.505: E/AndroidRuntime(2136): at com.Ibetter.tdm.ReqEditActivity.startCamera(ReqEditActivity.java:597)
02-08 07:32:11.505: E/AndroidRuntime(2136): at com.Ibetter.tdm.ReqEditActivity$4.onClick(ReqEditActivity.java:107)
02-08 07:32:11.505: E/AndroidRuntime(2136): at android.view.View.performClick(View.java:4202)
02-08 07:32:11.505: E/AndroidRuntime(2136): at android.view.View$PerformClick.run(View.java:17340)
02-08 07:32:11.505: E/AndroidRuntime(2136): at android.os.Handler.handleCallback(Handler.java:725)
02-08 07:32:11.505: E/AndroidRuntime(2136): at android.os.Handler.dispatchMessage(Handler.java:92)
02-08 07:32:11.505: E/AndroidRuntime(2136): at android.os.Looper.loop(Looper.java:137)
02-08 07:32:11.505: E/AndroidRuntime(2136): at android.app.ActivityThread.main(ActivityThread.java:5039)
02-08 07:32:11.505: E/AndroidRuntime(2136): at java.lang.reflect.Method.invokeNative(Native Method)
02-08 07:32:11.505: E/AndroidRuntime(2136): at java.lang.reflect.Method.invoke(Method.java:511)
02-08 07:32:11.505: E/AndroidRuntime(2136): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
02-08 07:32:11.505: E/AndroidRuntime(2136): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
02-08 07:32:11.505: E/AndroidRuntime(2136): at dalvik.system.NativeStart.main(Native Method)
02-08 07:32:13.935: I/Process(2136): Sending signal. PID: 2136 SIG: 9
02-08 07:32:14.835: E/Trace(2175): error opening trace file: No such file or directory (2)
02-08 07:32:14.835: W/Trace(2175): Unexpected value from nativeGetEnabledTags: 0