Code example for IntentFilter

Methods: addAction

0
            public void onReceive(Context context, Intent intent) {
                Log.i("test", "Storage: " + intent.getData());
                updateExternalStorageState(); 
            } 
        }; 
        IntentFilter filter = new IntentFilter();
        filter.addAction(Intent.ACTION_MEDIA_MOUNTED);
        filter.addAction(Intent.ACTION_MEDIA_REMOVED);
        registerReceiver(mExternalStorageReceiver, filter);
        updateExternalStorageState(); 
    } 
 
    void stopWatchingExternalStorage() { 
        unregisterReceiver(mExternalStorageReceiver);
    } 
 // END_INCLUDE(monitor_storage) 
 
 // BEGIN_INCLUDE(public_picture) 
    void createExternalStoragePublicPicture() { 
        // Create a path where we will place our picture in the user's