开发者

Image not on SD Card

开发者 https://www.devze.com 2022-12-25 10:02 出处:网络
I\'ve got a camera application and when I take a picture the image is stored. However I cannot see it on the SD Card until I reboot the device.

I've got a camera application and when I take a picture the image is stored. However I cannot see it on the SD Card until I reboot the device.

Any ideas why? Also when I view the image as a bitmap in my activity (After restarting) the picture is flipped the wrong way around. Any ideas about that?

My code is as follows:

Camera.PictureCallback photoCallback = new Camera.PictureCallback() {
  public void onPictureTaken(byte[] data, Camera camera) {
    // TODO Auto-generated method stub
    FileOutputStream fos;
    try
    {
      Bitmap bm = BitmapFactory.decodeByteArray(data, 0, data.length);
      fileUrl = MediaStore.Images.Media.insertImage(getContentResolver(), bm, "LastTaken", "Picture");

      if(fileUrl == null)
      {
        Log.d("Still", "Image Insert Failed");
        return;
      }
      else
      {
        picUri = Uri.parse(fileUrl);
        sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, picUri));
      }
    }
    catch(Exception e)
    {
      Log.d("Picture", "Error P开发者_开发百科icture: ", e);
    }
    camera.startPreview();
  }
};
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号