I think that there's a solution to my inheritance problem but I can't find it.
I'm developing an Android application (target is Android 2.1) which reuses a SlidingDrawer
(for my menu) on most of the pages. In order to avoid to initialize it on all the Activity I created a DefaultActivity
to do so. It worked well until I had to extends TabActivity
because Java doesn't support multiple inheritance.
Basically I have the following Default activity
public class DefaultActivity extends Activity{
// Declarations
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Some code
}
@Override
protected void onPause() {
// Some code
}
protected void initializeMenu() {
// Init
}
}
Now when I have an activity I do the following
public class SomeActivity extends DefaultActivity{
// Declarations
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.myLayout);
super.initializeMenu();
}
}
But I have a view which extends TabActivity
so I can't do
public class SomeOtherActivity extends TabActivity, DefaultActivity
How can I do to have only one class to extends but which contains the code for an Activity
and TabActivity
?
Thanks.