目前自己使用发送广播实现了效果
public void photo() {
Intent openCameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(openCameraIntent, TAKE_PICTURE);
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case TAKE_PICTURE:
if ( resultCode == RESULT_OK) {
String fileName = String.valueOf(System.currentTimeMillis());
Bitmap bm = (Bitmap) data.getExtras().get("data");
FileUtils.saveBitmap(bm, fileName);
String imagePath = FileUtils.SDPATH+fileName + ".JPEG";
//将刚拍照的相片在相册中显示
Uri localUri = Uri.fromFile(new File(imagePath));
Intent localIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, localUri);
sendBroadcast(localIntent);
}
break;
}