哎呀,我还是不能在发送拍照请求的意图时保存图片。这是我的做法:
Make a URI representing the pathname
android.content.Context c = getApplicationContext(); String fname = c.getFilesDir().getAbsolutePath()+"/parked.jpg"; java.io.File file = new java.io.File( fname ); Uri fileUri = Uri.fromFile(file);
Create the Intent (don't forget the pkg name!) and start the activity
private static int TAKE_PICTURE = 22; Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE ); intent.putExtra("com.droidstogo.boom1." + MediaStore.EXTRA_OUTPUT, fileUri); startActivityForResult( intent, TAKE_PICTURE );
The camera activity starts, and I can take a picture, and approve it. My
onActivityResult()
then gets called. But my file doesn't get written. The URI is: file:///data/data/com.droidstogo.boom1/files/parked.jpgI can create thumbnail OK (by not putting the extra into the Intent), and can write that file OK, and later read it back).
有没有人能看出我犯了什么简单的错误?在logcat中没有明显显示——相机明显已经拍照。谢谢。
Peter
我应该提一下,在AndroidManifest.xml文件中我已经设置了适当的权限:
<uses-permission android:name="android.permission.READ_OWNER_DATA" />
<uses-permission android:name="android.permission.WRITE_OWNER_DATA" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-library android:name="com.google.android.maps" />
</application>
有什么想法吗?有哪些尝试的方法,以获取更多关于问题的信息?