We would like to know how to open the device's camera, take a photo and storage it into the targetFile.
/* www .j a v a2 s .com*/ import java.io.File; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.provider.MediaStore; public class Main{ /** * Open the device's camera, take a photo and storage it into the targetFile * * @param activity * @param targetFile */ public static void pickFromCamera(Activity activity, File targetFile) { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE, null); intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(targetFile)); int requestCode = 10086; activity.startActivityForResult(intent, requestCode); } }