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);

  

你可能感兴趣的:(android)