Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- java.lang.RuntimeException:
- at android.app.ActivityThread.handleReceiver (ActivityThread.java:2733)
- at android.app.ActivityThread.-wrap14 (ActivityThread.java)
- at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1422)
- at android.os.Handler.dispatchMessage (Handler.java:102)
- at android.os.Looper.loop (Looper.java:148)
- at android.app.ActivityThread.main (ActivityThread.java:5452)
- at java.lang.reflect.Method.invoke (Method.java)
- at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:762)
- at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:652)
- Caused by: java.lang.NullPointerException:
- at maa.myapp.MyIntentSerice.onReceive (MyIntentSerice.java)
- at android.app.ActivityThread.handleReceiver (ActivityThread.java:2726)
- at android.app.ActivityThread.-wrap14 (ActivityThread.java)
- at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1422)
- public class MyIntentSerice extends BroadcastReceiver {
- public static final String RESUME_ACTION = "RESUME_ACTION";
- public static final String STOP_ACTION = "STOP_ACTION";
- public static int REQUEST_CODE_NOTIFICATION = 1212;
- public static Activity myActivityforservice;
- @Override
- public void onReceive(Context context, Intent intent) {
- String action = intent.getAction();
- ToggleButton music = MyIntentSerice.myActivityforservice.findViewById(R.id.toggleButton);
- Log.e("action", action);
- if (intent.getAction() != null) {
- switch (intent.getAction()) {
- case RESUME_ACTION:
- MApplication.sBus.post(PlaybackEvent.PAUSE);
- music.setChecked(false);
- break;
- case STOP_ACTION:
- MApplication.sBus.post(PlaybackEvent.PLAY);
- music.setChecked(true);
- break;
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment