android 扫描SDCard.

//android 扫描SDCard.
sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED,
Uri.parse(
"file://" + Environment.getExternalStorageDirectory().getAbsolutePath())));


//注册

IntentFilter f = new IntentFilter();
f.addAction(Intent.ACTION_MEDIA_SCANNER_STARTED);
f.addAction(Intent.ACTION_MEDIA_SCANNER_FINISHED);
f.addAction(Intent.ACTION_MEDIA_UNMOUNTED);
f.addDataScheme("file");
registerReceiver(mScanListener, f);

  

原文地址:https://www.cnblogs.com/wanqieddy/p/2104479.html