android.app.Activty
|
|
|
|
com.mycompany.ActivityWrapper
| <--------------------------------\
| \ |
| | |
| | |
| android.app.ListActivty android.app.ExpandableListActivity
| | |
| | |
| | |
MyActivity1 | |
| |
MyActivity2 MyActivity3
I need to make class (com.mycompany.ActivityWrapper) which extends android.app.Activity and extends following methods:
- onCreate
- onResume
- onConfigurationChanged
- onMenuOpened
I want all my activities (which already extends at the monent android.app.Activity, android.app.?ListActivity) use code of my com.mycompany.ActivityWrapper
I have no ideas how to implement this ( maybe via reflection %) ).
Help me, plz
I have some of the same issues, and although it pained me to do so the only useful way of doing it is by creating multiple base classes. For example, you would have a
ActivityWrapper
,ListActivityWrapper
,ExpandableListActivityWrapper
. You can get around some of the code duplication by moving the common code you want to call off into a new class, something likeActivityExtensions
, which you just call in to from the variousonCreate
methods and so on.