我发布了一个App,用户可以在里面拍照。我这样做是为了捕捉照片:
File file = new File( _path );
Uri outputFileUri = Uri.fromFile( file );
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE );
intent.putExtra( MediaStore.EXTRA_OUTPUT, outputFileUri );
startActivityForResult( intent, 0 );我还添加了这个权限来声明:
<uses-permission android:name="android.permission.CAMERA" />我在Android2.3.5和Android3.0上测试了我的应用程序,它在fine.But上工作。当我在Android4.0.3上运行我的应用程序时,它崩溃了:
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.media.action.IMAGE_CAPTURE (has extras) }我该如何解决这个问题呢?
发布于 2013-03-22 16:08:48
可能会发生几件事
中可能没有SD卡
你的案例是否符合上述任何一种情况?
发布于 2013-03-22 16:18:44
检查您的
1.平板电脑有摄像头(如果您使用的是平板电脑)。2.手机有摄像头3.没有安装SD卡
在清单中添加以下内容。
<uses-feature android:name="android.hardware.camera" />将阻止从google play下载应用程序。http://developer.android.com/google/play/filters.html
另请检查http://developer.android.com/guide/topics/manifest/uses-feature-element.html
检查您的设备是否有摄像头。
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.main);
Context context = this;
PackageManager packageManager = context.getPackageManager();
// if device support camera?
if (packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
//yes
Log.i("camera", "This device has camera!");
}else{
//no
Log.i("camera", "This device has no camera!");
}
}
}https://stackoverflow.com/questions/15565390
复制相似问题