开发者

need to extend two classes somehow

I am creating an app which has a dashboard layout as its home screen and each icon opens a seperate activity.

I have an abstract class called DashboardActivity which has methoda such as what to do when the home button in the title bar is pressed etc.

I then have various classes such as 'hotels' which will display a list of hotels. This class extends DashboardActivity but I also need i开发者_开发技巧t to extend ListActivity because it will be a list but I know that this can't be done.

What workaround can I use to overcome this problem? Thanks


I have had similar problem. The way I solved it was make a base class for each. DashboardListActivity and DashboardActivity. I'm not sure of a better way. Then in List activities, just extend DashboardListActivity.

There might be a better way, but I don't know it. Of course, you have dual maintenance on these two base classes so there is a trade off.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜