Esempio n. 1
0
 @Override
 public void onReceive(Context context, Intent intent) {
   // TODO Auto-generated method stub
   String action = intent.getAction();
   if (Intent.ACTION_MEDIA_MOUNTED.equals(action)) {
     Toast.makeText(context, "SDCard准备就绪", 0).show();
   } else if (Intent.ACTION_MEDIA_REMOVED.equals(action)) {
     Toast.makeText(context, "SDCard被拔掉", 0).show();
   } else if (Intent.ACTION_MEDIA_UNMOUNTED.equals(action)) {
     Toast.makeText(context, "SDCard被卸载", 0).show();
   }
 }
 @Override
 public void onReceive(Context context, Intent intent) {
   String action = intent.getAction();
   if (Intent.ACTION_MEDIA_SCANNER_STARTED.equals(action)
       || Intent.ACTION_MEDIA_SCANNER_FINISHED.equals(action)) {
     MusicUtils.setSpinnerState(SelectFolderActivity.this);
     mReScanHandler.sendEmptyMessage(0);
   }
   if (Intent.ACTION_MEDIA_UNMOUNTED.equals(action)) {
     mReScanHandler.sendEmptyMessage(1);
   }
 }
 @Override
 public void onReceive(Context arg0, Intent intent) {
   Runnable r =
       new Runnable() {
         public void run() {
           try {
             if (currentDir == null) {
               listRoots();
             } else {
               listFiles(currentDir);
             }
           } catch (Exception e) {
             FileLog.e("tmessages", e);
           }
         }
       };
   if (Intent.ACTION_MEDIA_UNMOUNTED.equals(intent.getAction())) {
     listView.postDelayed(r, 1000);
   } else {
     r.run();
   }
 }