Reputation: 441
I have a Listview,when i click on the list it shows the details part,in that activity it shows 3 menu option Details,Party and Attachment.When i click on details it should show the same details part.After i click on Party it shows list of parties and again whn i click on menu it shows 3 menu option Details,Party and Attachment and clicking on details menu should show the same details part. Is that possible, plz help me out.
Upvotes: 0
Views: 428
Reputation: 8302
If you are trying to make 3 Activities with the same menu, you can make a abstract base Activity that implements the menu and then extend that with your 3 concrete Activities.
public abstract class ActivityWithMenu extends Activity {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// add your code here
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// add your code here
}
}
Then in another Acitivity class, you can create the 3 different activities, something like:
public class DetailsActivity extends ActivityWithMenu {
// add your implementation here - the menu will already be taken care of in the base class
}
This way, you have 1 common menu for 3 activities. I hope that helps.
Upvotes: 2