views:

325

answers:

2

Dear friends,

I want to place a common banner and menu on each Activity with footer too.

Can anyone guide me how can I implement master and child page like asp.net in Android???

Any help would be appreciated.

+4  A: 

You could have each of your Activities extend a common base class which has a onCreateOptionsMenu method which inflates the menu from the same XML each time. Though as you can't have multiple inheritance, this may be tricky when you want to have plain activities and list activities, for example.

Another way would be to have a Util class where you have a method like setupMenu(Menu) which each of your Activities can call if you're doing some more complex menu setup.

In terms of the XML UI layout for each of your Activities, you can include a common banner by using the <include/> tag.

Christopher
to implement commomn banner could you please provide me example????
UMMA
The link in my answer has an example. The Android home screen application includes the entire layout of the workspace_screen.xml multiple times by using the <include> tag.
Christopher
A: 

I've had the same problem and solved it using ActivityGroup. I suppose that menu items will move user to another activity, so with the same menu in every activity closing application with BACK button can be almost impossible (after some time user will have to go back through all activities he had ever seen).

I haven't found any good tutorials in english so have written mine some time ago (it's somewhat too short and in polish only, but Google Tranlslated version should be understandable) check this

You can also check how the TabHost works

skyman