tags:

views:

29

answers:

1

I'm fairly new to object-oriented programming, and I'm really interested in learning it correctly. My problem is this:

I am trying to create a TabActivity which plots the user's data over time in each tab's content. Then only thing the tabs are going to control is the timespan of the graph. (i.e. one tab for 'past year', one for 'past month', one for 'all time', etc). As you can see, the layout used for each tab will be identical. The code used for each tab will only differ by a couple lines... (the starting and ending date of the x-axis).

I'm not sure how I can pull this off in a well-designed, object-o fashion. Any ideas?

A: 

ok...as far as I know you can give this a try :

Make on super class A that extends Acitivity.. This particular class will have all the Acitivity life cycle methods.

Now make child class A1 extending class A (since A is activity, A1 will also be an acitivity) you can start this activity in Tab 1.

Make child class A2 extending class A (since A is activity, A2 will also be an acitivity) you can start this activity in Tab 2.

Make child class A3 extending class A (since A is activity, A3 will also be an acitivity) you can start this activity in Tab 3.

Don't forget to declare activities A1, A2, A3 AndroidManifest.xml.

success_anil