[android-developers] Same Title bar but different view below it?

2010-04-09 Thread javame_android
Hi,

In one of my Android Application I need to keep the title bar same but
the view that is shown in the rest of the screen changes. So, I have
taken different Activity for all the views that I need to show and set
the title bar in every Activities onCreate method.

Now, the problem is that I have a button in the title bar and need to
perform certain action on its click event. Writing the same event
handling code in every Activity class is very cumbersome. Is there any
other way out that whenever there is a click event on that button of
the title bar then we can have the same functionality without writing
the same code in all the Activity classes.

Can we use ViewGroup for that? I don't have much idea about ViewGroup.
Is that possible with ViewGroup?

If anyone knows the solution then please let me know.

Thanks  Regards
Sunil

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe, reply using remove me as the subject.


Re: [android-developers] Same Title bar but different view below it?

2010-04-09 Thread Mark Murphy
javame_android wrote:
 In one of my Android Application I need to keep the title bar same but
 the view that is shown in the rest of the screen changes. So, I have
 taken different Activity for all the views that I need to show and set
 the title bar in every Activities onCreate method.
 
 Now, the problem is that I have a button in the title bar and need to
 perform certain action on its click event. Writing the same event
 handling code in every Activity class is very cumbersome. Is there any
 other way out that whenever there is a click event on that button of
 the title bar then we can have the same functionality without writing
 the same code in all the Activity classes.

Step #1: Create a subclass of Activity that includes your button logic

Step #2: Have your other activities subclass the class you created in
step #1

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_
Version 1.4 Available!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe, reply using remove me as the subject.