Design a template to expand the activity of Android?

While programming on Android, I end up recording parent activity, which is expanded by several others. Like a little bit ListActivity. My parenting activity is expanding Activity. if I intend to use Mapor List, I cannot use my parent activity as a superclass - a child activity can only extend one action. Thus, I ended up writing their parental actions with the same logic for Activity, ListActivity, MapActivityetc.

What I'm looking for is some kind of design feature / template that will help in this case. Any suggestions?

+5
source share
3 answers

I really do not like ListActivity, MapActivityetc. Basically, these are actions that simply add one element of the view due to some flexibility. By adding MapViewor ListViewto your XML appropriately, you get the exact same thing that can directly extend a derived superclass of a class Activity. Therefore, simply do not use any of these SomethingActivity classes for the most part.

+3
source

As a result, I have a base MyAbstractActivity extends Activitythat includes common logic and MyAbstractListActivity extends MyAbstractActivitythat simulates ListActivity(inflates layout.R.id.list, layout.R.id.emptyetc.), not much happens there).

+1
source

. .
, . , , , . 30 , , .

+1

All Articles