简体   繁体   中英

how to maintain focus between two screen component?

In my two screen app first screen has some button, from here control jump to other activity. Now when control return to first activity from second, how can focus for last action item?

Also please suggest how can do same thing while communicating between two fragment?

Have you tried calling requestFocus() on the control in your first activity's onResume() method?

If you need to remember which control was tapped (and therefore which one should have focus), you can save a reference to in whatever code starts the second activity (such as that control's OnClickListener ), and use that information in onResume() .

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