Is it possible to change ToggleButton
state (checked/unchecked) from service?
I am passing boolean value via SharedPreference
after togglebutton click(checked) and reset it after stop recording at service (service is still running after it).
But how i can change ToggleButton state
?
You can listen sharedprefs changes via OnSharedPreferenceChangeListener . So from service set boolean flag in prefs. Listen for your flag from activity and change toggle button state.
There are a lot different ways.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.