Cocoa Dev
Cocoa Dev

Reputation: 9541

Android with TabHost and Lists

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

Answers (2)

Phil
Phil

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

user802421
user802421

Reputation: 7505

It's enough to do:

public class AlbumsActivity extends ListActivity

ListActivity extends Activity anyway.

Upvotes: 1

Related Questions