我正在使用以下函数从Bitmap获取Uri:
Uri GetImjUriFrmBitmapFnc(Bitmap SrcBitmapPsgVal)
{
ByteArrayOutputStream BytAryOptVaj = new ByteArrayOutputStream();
SrcBitmapPsgVal.compress(Bitmap.CompressFormat.PNG, 100, BytAryOptVaj);
String ImjPthVar = MediaStore.Images.Media.insertImage(getContentResolver(), SrcBitmapPsgVal, "TmpTtl", null);
Uri ImjBitmapUriVar = Uri.parse(ImjPthVar);
return ImjBitmapUriVar;
}
我正在使用以下函数从Uri获取Bitmap:
Bitmap GetImjBitmapFrmImjUriFnc(Uri ImjUriPsgVaj, boolean WanDelImjPsgVab)
{
Bitmap OptImjBitmapVar;
try
{
OptImjBitmapVar = MediaStore.Images.Media.getBitmap(this.getContentResolver(), ImjUriPsgVaj);
if(WanDelImjPsgVab) FylDelImjUsgUriFnc(ImjUriPsgVaj);
}
catch (IOException ErrVar)
{
ErrVar.printStackTrace();
return null;
}
return OptImjBitmapVar;
}
void FylDelImjUsgUriFnc(Uri FylUriPsgVal)
{
getContentResolver().delete(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
MediaStore.Images.ImageColumns.DATA + "=?",
new String[]{FylUriPsgVal.getPath()});
}
boolean FylDelFnc(Uri FylUriPsgVal)
{
File DelFylVaj = new File(FylUriPsgVal.getPath());
if (DelFylVaj.exists()) return DelFylVaj.delete();
else return false;
}
我尝试使用方法
FylDelImjUsgUriFnc(Uri FylUriPsgVal) <br>
FylDelFnc(Uri FylUriPsgVal)
但它不起作用......
请告诉我如何删除已创建的Uri ...
| * |请忽略我正在使用的函数和变量名称的差异....