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 开发者_如何学JAVAiOS 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
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.
It's enough to do:
public class AlbumsActivity extends ListActivity
ListActivity extends Activity anyway.
精彩评论