I have an application code base with several actions. I have a BaseActivity
class that extends the Activity
class and is the parent class for all Activities in my application. BaseActivity
takes care of the state that my application leaves in the background and returns to the foreground. Now I have written several operations that use fragments
so that these new actions are extended by FragmentActivity
. But my application requires that all actions extend the BaseActivity
class.
The solution in my opinion:
- BaseActivity extends FragmentActivity instead of the Activity class.
- New actions (with fragments) extend BaseActivity instead of directly expanding FragmentActivity.
With this solution, I am afraid of any side effect in my existing actions that extend the Activity
class (via BaseActivity
). Now these actions will be expanded by FragmentActivity
(although they do not have fragments inside). This is normal if I extend FragmentActivity
, even if I don't have a fragment inside. Will it behave the same as Activity?
source share