I am new in Android programming. I want to do a Fragment, I have seen examples that uses Fragment and FragmentActivity, What's the difference between them and which cases should be used each one? Thanks
FragmentActivity is our classic Activity with fragment support, nothing more. Therefore FragmentActivity is needed, when a Fragment will be attached to Activity.
Well Fragment is good component that copy the basic behaviors of Activity, still not a stand-alone application component like Activity and needs to be attached to Activity in order to work.
Read here Difference between Fragment And FragmentActivity
FragmentActivity
is part of the google-support-v4
lib which is basically adds a Fragment support to system with OS under 2.3. So FragmentActivity
is exactly as a simple Activity
only it gives you the ability to add Fragment to it.
Fragment
is an object that shares parts of the Activity
life cycle and can be added as part of you UI to an Activity
or FragmentActivity
with it's logic. the beauty of Fragment
s is that can be reused across different Activities
in your application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With