简体   繁体   中英

Launch activity from widget and then back to widget

I've an desktop widget, and inside it I have a settings button - when tap it, I launch an activity, where I can change widget settings. An activity is very simple, it has only few spinner, checkboxes, etc. and 2 button - OK and CANCEL.

And the biggest problem for me is, that I know how to launch activity from widget, but don't know how to "go back" to widget from activity - the only possible way is press the back button on the phone. But as u can see, I really need to have 2 buttons - OK and Cancel, as its looks much more natural for the user. What method I should use after pressing OK/Cancel button to turn an activity to background and widget to foreground?

尝试这个

   in onclicklistener of ok button call finish()

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM