Guest User

Untitled

a guest
Jan 20th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. java.lang.RuntimeException:
  2. at android.app.ActivityThread.handleReceiver (ActivityThread.java:2733)
  3. at android.app.ActivityThread.-wrap14 (ActivityThread.java)
  4. at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1422)
  5. at android.os.Handler.dispatchMessage (Handler.java:102)
  6. at android.os.Looper.loop (Looper.java:148)
  7. at android.app.ActivityThread.main (ActivityThread.java:5452)
  8. at java.lang.reflect.Method.invoke (Method.java)
  9. at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:762)
  10. at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:652)
  11. Caused by: java.lang.NullPointerException:
  12. at maa.myapp.MyIntentSerice.onReceive (MyIntentSerice.java)
  13. at android.app.ActivityThread.handleReceiver (ActivityThread.java:2726)
  14. at android.app.ActivityThread.-wrap14 (ActivityThread.java)
  15. at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1422)
  16.  
  17. public class MyIntentSerice extends BroadcastReceiver {
  18. public static final String RESUME_ACTION = "RESUME_ACTION";
  19. public static final String STOP_ACTION = "STOP_ACTION";
  20. public static int REQUEST_CODE_NOTIFICATION = 1212;
  21. public static Activity myActivityforservice;
  22.  
  23. @Override
  24. public void onReceive(Context context, Intent intent) {
  25. String action = intent.getAction();
  26. ToggleButton music = MyIntentSerice.myActivityforservice.findViewById(R.id.toggleButton);
  27. Log.e("action", action);
  28. if (intent.getAction() != null) {
  29. switch (intent.getAction()) {
  30. case RESUME_ACTION:
  31. MApplication.sBus.post(PlaybackEvent.PAUSE);
  32. music.setChecked(false);
  33. break;
  34. case STOP_ACTION:
  35. MApplication.sBus.post(PlaybackEvent.PLAY);
  36. music.setChecked(true);
  37. break;
  38. }
  39. }
  40. }
  41. }
Add Comment
Please, Sign In to add comment