android,a Receiver intent is null
<p>this is my receiver.viewChanger is my original class .</p>

<pre><code>public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
            viewChanger vc = new viewChanger();

        if(action.equals("android.intent.action.TIME_TICK")){
            vc.setDateView(context);

        }else if(action.equals("android.intent.action.BATTERY_CHANGED")){
            int level = intent.getIntExtra("level", 0);
            vc.setBatteryView(level, context);

        }else if(action.equals(Intent.ACTION_POWER_CONNECTED)){
            int charging = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1);
            vc.setAcusbView(charging, context);

        }else if(action.equals(Intent.ACTION_POWER_DISCONNECTED)){
            vc.setAcusbNullView(context);
        }

    }
</code></pre>

<p>my trouble is</p>

<pre><code>int charging = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1);
</code></pre>

<p>this intent seems to be empty,charging get to be "-1"
what is wrong for me?</p>
