android - How to listen to a closed activity from a widget? (onActivityResult is only in Activity) -


i have widget launches activity, when activity finishes using finish() don't know how widget can know since can't override onactivityresult() seems way listen when activity closes...

anyone know of way listen when activity closes when widget launches activity?

in case helps, here code i'm using in widget launch activity

 @override  public void onupdate(context context,      appwidgetmanager appwidgetmanager, int[] appwidgetids) {   intent = new intent(context, choosecontact.class);  pendingintent pendingintent = pendingintent.getactivity(context,0,i,0);   remoteviews updateviews = new remoteviews(context.getpackagename(), r.layout.main);  updateviews.setonclickpendingintent(r.id.button, pendingintent);   appwidgetmanager.updateappwidget(appwidgetids, updateviews);    // not necessary, habit   super.onupdate(context, appwidgetmanager, appwidgetids);   } 

as said, it's better activity update widget. can override onstop method of activity, , send intent widget ask redraw... this:

@override protected void onstop() {     super.onstop();      // save settings     // ...      // update widget     intent intent = new intent("com.mywidget.action.settings_changed");     intent.putextra(appwidgetmanager.extra_appwidget_ids, new int[] { widgetid });     intent.setdata(uri.withappendedpath(uri.parse(app.uri_scheme + "://widget/id/"),         string.valueof(widgetid)));     sendbroadcast(intent); } 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -