In my Java Android App's MainActivity I have a Toolbar on top (set via setSupportActionBar(Toolbar)
) with a youAreloggedIn
icon. On starting the app and before it shows or soon after, I want to make a remote connection, check if user is logged in to that remote server and change the icon to indicate that: a lock if not logged in (which is the default) or an opened-lock if user is logged in.
My question is in which callback I should place this code (network enquire and icon change). Right now I have the code at the end of onCreateOptionsMenu()
after the menu is inflated.
Is there another onXXX()
callback which is more suitable?
Apparently, onStart()
is called before the menu is inflated! And so, I can't change icons in there before the menu in the toolbar is created!
Something like onSteadyState()
perhaps ?
question from:
https://stackoverflow.com/questions/65876813/android-app-change-menu-on-startup-at-what-stage 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…