FileDocCategorySizeDatePackage
MediaScannerActivity.javaAPI DocAndroid 1.5 API2593Wed May 06 22:41:08 BST 2009com.android.development

MediaScannerActivity

public class MediaScannerActivity extends android.app.Activity

Fields Summary
private final android.content.BroadcastReceiver
mReceiver
private android.widget.TextView
mTitle
Constructors Summary
public MediaScannerActivity()

    
Methods Summary
public voidonPause()
Called when the activity going into the background or being destroyed.

        super.onPause();
        unregisterReceiver(mReceiver);
    
public voidonResume()
Called when the activity is first created or resumed.

        super.onResume();
        
        setContentView(R.layout.media_scanner_activity);
        
        IntentFilter intentFilter = new IntentFilter(Intent.ACTION_MEDIA_SCANNER_STARTED);
        intentFilter.addAction(Intent.ACTION_MEDIA_SCANNER_FINISHED);
        intentFilter.addDataScheme("file");
        registerReceiver(mReceiver, intentFilter);
        
        sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://"
                + Environment.getExternalStorageDirectory())));
            
        mTitle = (TextView) findViewById(R.id.title);
        mTitle.setText("Sent ACTION_MEDIA_MOUNTED to trigger the Media Scanner.");