Reputation: 9541
I am writing an Android app that has a Tabs (3)
Each Tab should have a listview
I know that Java has a limitation of extending 1 class.
My current code is
public class AlbumsActivity extends Activity {
I would like to do this
public class AlbumsActivity extends Activity, ListActivity {
I come from the world of iOS so multiple inheritence is OK in Obj-C but I know its a big NO NO in Java.
So how do I solve this? I know its possible because Spotify has done it
Upvotes: 0
Views: 65
Reputation: 36289
ListActivity is a subclass of Activity, so you can simply use:
public class AlbumsActivity extends ListActivity
and you will get all the methods from both classes.
Upvotes: 2
Reputation: 7505
It's enough to do:
public class AlbumsActivity extends ListActivity
ListActivity extends Activity anyway.
Upvotes: 1