I am working on a header for an app. The header will have 4 buttons. Each button will have a listener and some code to send it to the home of that button.
The Java code for the buttons will be the same so I am wondering what I can do so that I can have that code in one place and reuse it in all my screens. How do people typically handle this kind of a scenario? Should/can I make a utility class and just import that? If I do, then how do I handle code like this so it would know which intent I am on?
Intent myIntent = new Intent(CurrActivity.this, NextActivity.class);
CurrActivity.this.startActivity(myIntent);
Thanks!
A couple of options I can think of:-
With both options you should look at the include tag that will allow you to share the xml that defines your navigation across layouts.
http://developer.android.com/resources/articles/layout-tricks-reuse.html
Hope that helps.