Eclipse 在以下代码中给了我一个 TAKE_PICTURE 错误。我尝试用 CAMERA_PIC_REQUEST 替换它并得到同样的错误。我在这里为 Android 4.2 开发。
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
File file = new File(Environment.getExternalStorageDirectory(), "test.jpeg");
Uri outputFileUri = Uri.fromFile(file);
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
startActivityForResult(intent, TAKE_PICTURE);
}
任何想法我必须做什么?