Change app UI from notification action in android -
i working on to-do list android app has feature of users being able set reminders shown in notification bar. notification contains "completed" action associated it. when action pressed, makes changes sql lite database. works fine if app closed. if app still open , press on notification action, ui doesnt change automatically. have close app , start again see changed data. there way cause activity reload in way reflect changes if activity open.
there several solutions:
- use
dataprovider
, callcontext.getcontentresolver().notifychange()
notify observers new data appropriateuri
- use
localbroadcastmanager
register receiver in activity , later notify changes. - use non standard methods of notifying updated data. instance otto
so, recommend read observer
pattern because solutions it.
Comments
Post a Comment