-1

我正在开发一个 android 应用程序。在这我必须实现相机功能。当我单击按钮时,它应该启动,当我捕获图像时,它应该返回带有该图像的主应用程序。我怎样才能实现这一点?任何帮助将不胜感激。

4

1 回答 1

0

在下面写代码onClick()

Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
File dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM);
File output = new File(dir,captureimage.png");

cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT,Uri.fromFile(output));
String path = output.getAbsolutePath();  <---------here you will get file path also
startActivityForResult(cameraIntent, TAKE_PHOTO);
于 2012-10-06T09:43:55.823 回答