我在Google上查找“android take picture”得到一堆帖子告诉你怎样自己写代码去拍照并存储。事实上我想调用系统的Activity去拍照,我需要的是系统的Activity拍照后告诉我图片存储路径即可。
实际上系统有个MediaStore中记录着这个Activity的名字 MediaStore.ACTION_IMAGE_CAPTURE
在Google Code Search中查一下
MediaStore.java/** * Standard Intent action that can be sent to have the camera application * capture an image and return it. *SlideEditorActivity.java* The caller may pass an extra EXTRA_OUTPUT to control where this image will be written. * If the EXTRA_OUTPUT is not present, then a small sized image is returned as a Bitmap * object in the extra field. This is useful for applications that only need a small image. * If the EXTRA_OUTPUT is present, then the full-sized image will be written to the Uri * value of EXTRA_OUTPUT. * @see #EXTRA_OUTPUT * @see #EXTRA_VIDEO_QUALITY */ public final static String ACTION_IMAGE_CAPTURE = "android.media.action.IMAGE_CAPTURE";
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { //.............. case MENU_TAKE_PICTURE: intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(intent, REQUEST_CODE_TAKE_PICTURE); break; //.................... } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode != RESULT_OK) { return; } switch(requestCode) { //.............. case REQUEST_CODE_TAKE_PICTURE: Bitmap bitmap = (Bitmap) data.getParcelableExtra("data"); //....................