0

So I've been working on and Android app that has a Sherlock action Bar on the top and that part is working fine but now I want to be able to dynamically add Menu Items to the Sherlock Action Bar. I have to display log in name on screen if user is log in. Suppose on Activity A I have Log in Button. When that button is clicked then LoginActivity starts. After log in B activity is start. If user pressed back button from activity B then Activity A again starts. But menu items name is not displays. For that I am using onCreateOptionsMenu method.

user2799407
  • 549
  • 1
  • 6
  • 16
  • in what activity you want to show logged user name? A, Login, B? You want to show name as a title? – agamov Mar 19 '14 at 13:14
  • In activity A. I am using getSupportMenuInflater().inflate(R.menu.home_menu, menu); in onCreateOptionsMenu method.\ – user2799407 Mar 19 '14 at 13:16

1 Answers1

0

Maybe this should help you: What onPrepareOptionsMenu do?

i.e., use onPrepareOptionsMenu() method

Community
  • 1
  • 1
agamov
  • 4,407
  • 1
  • 27
  • 31