makerofthings7
makerofthings7

Reputation: 61433

What are the benefits of the V13 Android Support Library?

I'm searching for the benefits of android.support.v13.app and from the SDK it appears to benefit Fragments in someway.

Since I'm new to fragments in general, I'd like to learn if all fragments rely on this particular library, and what improvements have been made between V13 and the modern API.

I looked at the training material here, see that fragments were introduced in API 11, and am trying to understand the benefit of v13.

Can anyone explain the benefits of this library, and/or how it enables more flexibility in development?

Upvotes: 0

Views: 161

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006614

I'd like to learn if all fragments rely on this particular library

No fragments rely upon that library.

what improvements have been made between V13 and the modern API

There are no fragments in that library.

Can anyone explain the benefits of this library

There are two "classic" Android Support libraries, known as support-v4 and support-v13. If you hear of somebody referring to "the Android Support library", they mean support-v4. support-v4 has lots and lots of things (all of the android.support.v4.* packages). Among those things are two items of relevance for this answer:

  • support-v4 has a backport of fragments, for apps supporting devices that are older than API Level 11

  • support-v4 has ViewPager — if you have seen apps with "page at a time" horizontal swipe support, odds are that is ViewPager

ViewPager uses a PagerAdapter to supply the pages. Two concrete PagerAdapter implementations ship with support-v4: FragmentPagerAdapter and FragmentStatePagerAdapter. Since this is support-v4, those classes use the backported fragments (android.support.v4.app.Fragment) for their pages.

Historically, support-v13 had just implementations of FragmentPagerAdapter and FragmentStatePagerAdapter that support the native, API Level 11 implementation of fragments (android.app.Fragment).

More recently, support-v13 added:

  • An implementation of FragmentTabHost that uses fragments for the contents of the tabs

  • FragmentCompat, which, like most ...Compat classes in Android, provide some static helper methods to make it easier for you to use APIs akin to the latest-and-greatest version of Android, with graceful degradation to older versions of Android

Of note, the support-v13 FragmentCompat provides static methods to help you use the new Android 6.0 runtime permissions system with the API Level 11 edition of fragments.

Upvotes: 1

Related Questions