I want to develop an application that has 4 buttons top and 4 buttons bottom in all activities. The problem is that I don’t want to define button’s handlers in all activities (because it is simpler to make modifications in only 1 place).
One solution I thought was: Do a Main Menu that extends Activity then extend all activities from Main Menu. However, I want to use Lists that extend from ListActivity.
Is there a way to declare and define handlers only once and use those buttons in all activities?
Solved that issue implementing a singleton class.
Imagine that an application had 4 fixed buttons. You write 4 methods for those buttons in the singleton class and then call them from every Activity you write. Isn’t the perfect solution, however it grants you a single space where you can change the handlers and spread those modifications automatically by all activities.
Hope it helps someone.