• 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 ...
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris

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

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
For my next trick, I'll need the help of a tiny ad ...
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
    Bookmark Topic Watch Topic
  • New Topic