Code example for Intent

Methods: getActiongetIntExtra

0
        mLog.setText(mLog.getText() + "\n" + mDateFormat.format(new Date()) + ": " + s);
    } 
 
    BroadcastReceiver mReceiver = new BroadcastReceiver() {
        public void onReceive(Context context, Intent intent) { 
            String action = intent.getAction(); 
            String title = action; 
            int index = title.lastIndexOf('.'); 
            if (index >= 0) { 
                title = title.substring(index + 1); 
            } 
            if (Intent.ACTION_BATTERY_CHANGED.equals(action)) { 
                int level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1); 
                log(title + ": level=" + level); 
            } else { 
                log(title); 
            } 
        } 
    }; 
 
    class SpinThread extends Thread {