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();
}
};
精彩评论