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

  

posted @ 2011-07-12 17:26  wanqi  阅读(1067)  评论(0编辑  收藏  举报