javaandroidremoteview

Change the boolean value of an activity toggle from a remoteView?


Cant seem to find a solution to this issue.

I have a notification that has a button, I need that notification button(that's located in a service class) to be able to effect a boolean value of a toggle that's located inside an Activity.Any ideas?

Possible to manipulate Activity components like buttons from a RemoteView?


Solution

  • You can use LocalBroadcastReceiver to send broadcast when that button is clicked. Register that broadcast receiver in your activity, its onReceive() method will be called inside activity whenever button in notification will be pressed and you can do whatever you want in your activity.