嗨,我正在将相机中的图像(拍照)插入mediastore.images.media数据存储。
有人知道我怎样才能展示最后一张照片吗?
我使用uri image=contenturis.withAppendedID(externalContenturi,45);显示数据存储中的图像,但显然45不是正确的图像。
我尝试将信息从上一个活动(相机)传递到显示活动,但我假设由于照片回拨是它自己的线程,所以值永远不会被设置。照片代码如下
camera.pictureCallback photocallback=新建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 Picture: ", e);
}
camera.startPreview();
}
};