import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import java.io.File;
import android.os.Environment;

Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);

// 指定要刷新的文件路径(必须/storage/emulated/0/开头)
//intent.setData(Uri.fromFile(new File("/storage/emulated/0/Download/"))); 

//刷新内部存储
intent.setData(Uri.fromFile(Environment.getExternalStorageDirectory()));

context.sendBroadcast(intent);

也可以使用广播刷新
 
 
Back to Top