Android中调用照相机拍照

                  Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                  String strPath = Environment.getExternalStorageDirectory() +File.separator;
                  File path = new File(strPath);
                  if(!path.exists())
                  path.mkdirs();
                  String strFileName = "test.jpg";
                  String strFilePath = strPath + "/" + strFileName;
 
                  File file = new File(strFilePath);
                  Uri uri = Uri.fromFile(file);
                  intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
                  startActivityForResult(intent, 1);  
posted @ 2011-10-20 21:01  图形学小菜鸟  阅读(1399)  评论(0编辑  收藏  举报