Android SDK创建图像并立即在图库中查看

Android SDK创建图像并立即在图库中查看,android,camera,gallery,Android,Camera,Gallery,我已经疯狂地尝试创建一个图像并将其显示在图库中(无需重新扫描SD卡)。我正在尝试下面的代码。在我的HTC Thunderbolt上,确实创建了该图像,但是,它的图库中会显示一个空白图像。有什么想法吗 私有ImageData savePhoto(位图newBmp、字符串文件名、字符串日期)引发IOException { String path = getImagePath(); File fileDir = new File(path); if(! fileDir.ex

我已经疯狂地尝试创建一个图像并将其显示在图库中(无需重新扫描SD卡)。我正在尝试下面的代码。在我的HTC Thunderbolt上,确实创建了该图像,但是,它的图库中会显示一个空白图像。有什么想法吗

私有ImageData savePhoto(位图newBmp、字符串文件名、字符串日期)引发IOException {

    String path = getImagePath();

    File fileDir = new File(path);

    if(! fileDir.exists()){
       fileDir.mkdirs();
    }

    File fileToCreate = new File(path + "/" + fileName);
    fileToCreate.createNewFile();

    FileOutputStream out = new FileOutputStream(fileToCreate);
    newBmp.compress(Bitmap.CompressFormat.JPEG, 90, out);


    ImageData newImageData = getImageDataOfLastPictureTaken();
    MediaStore.Images.Thumbnails.getThumbnail(getContentResolver(),newImageData.id, MediaStore.Images.Thumbnails.MICRO_KIND, null);
    MediaStore.Images.Thumbnails.getThumbnail(getContentResolver(),newImageData.id, MediaStore.Images.Thumbnails.MINI_KIND, null);

    AppVars.getInstance().PicturesTakenInSession.add(newImageData.id);
    //
    return newImageData;
}

    ImageData newImageData = getImageDataOfLastPictureTaken();
    AppVars.getInstance().PicturesTakenInSession.add(newImageData.id);