/**
* 通知android媒体库更新文件夹
*
* @param filePath ilePath 文件绝对路径,、/sda/aaa/jjj.jpg
*/
public void scanFile(Context context, String filePath) {
try {
MediaScannerConnection.scanFile(context, new String[]{filePath}, null,
new MediaScannerConnection.OnScanCompletedListener() {
public void onScanCompleted(String path, Uri uri) {
Log.i("TAG", "Scanned " + path + ":");
Log.i("TAG", "-> uri=" + uri);
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
网友评论