[英]how can i override the saved image in external storage android
我创建了一种将图像保存在外部存储中的方法。 下次我再次调用此方法时,它无法保存图像,因为该名称图像已保存。 有什么方法可以覆盖已保存的图像。
检查是否已存在相同名称的图像。 然后删除图像(如果存在)。 然后存储新图像。
您可以尝试此方法-
/**
* We need to notify the MediaScanner when a new file is created.
* In this way all the gallery applications will be notified too.
*
* @param filepath
*/
private void updateMedia( String filepath ) {
Log.i( LOG_TAG, "updateMedia: " + filepath );
MediaScannerConnection.scanFile( getApplicationContext(), new String[] { filepath }, null, null );
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.