• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to create a Menubar/Actionbar class instead of writing actionbar code for every class

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can I remove all the code pertaining to my Actionbar/Menubar from every activity and put it in a single class. Then instantiate that class and include it in every single one of my activities (is this possible or this code needs to be repeated in every activity?). That way I can reuse the code instead of typing the code all over again. The first thing I did was to move all code from Actionbar and create a single class. Then I instantiate the MenubarActivity class in every activity but that is not working. If someone can give me some clues how to/what is the best way to achieve this. Or what am I doing wrong on my code. Thanks MenubarActivity code:



Menu for actionbar



Instatiating MenuBarActivity in all activities


what is the proper way to include the MenuBarActivity in every single activity, so the actionbar gets displayed with the activity? Thanks
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic