简体   繁体   English

这个意图有什么问题?

[英]What's wrong with this Intent?

What I am trying to do is, when the user chooses this option, my Android app runs an intent. 我想做的是,当用户选择此选项时,我的Android应用程序将运行一个意图。 The intent calls for the camera of the Android device, and the camera takes a picture, and then saves the file into the directory named posense. 该意图调用Android设备的相机,然后相机拍摄照片,然后将文件保存到名为posense的目录中。

path = Environment.getExternalStorageDirectory().getName() + File.separatorChar + "posense";
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
File photo = new File(path);
Intent newintent = intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photo));
imageuri = Uri.fromFile(photo);
startActivityForResult(newintent, 1);

Make sure that you have correct permissions in your manifest. 确保清单中具有正确的权限。 They would be: 他们将是:

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM