Hi Android Developers,
The support library is not something you haven't heard of. If you use IDEs like Eclipse or Android Studio, they just automatically include it in every new project you create. For most of the developers, its purpose is obvious. This article is for developers who are wondering "what the heck support v4 is doing and why we need that". Now I'm wondering whether this should have been the blog title.
If you have started developing in the pre-support library era like me, then you would say that this support library is one of the awesome things from Android Team. Let me share my story.
It was the period of simple classes. No fragments, loaders and ActionBars. We were happily complaining how Android screen is fragmented across devices just to get additional time from boss and enjoying those hard earned time in social networks. Then came the fragments. The best way till date to address screen size problems. But fragments were introduced in Android 3.0. So if you want to use them, you can only support the devices with 3.0 and above. We were happy to. But the management and the clients thought otherwise. At that time, < 3.0 devices had almost entire market. If You didn't support them then you were developing Apps for almost nothing.
To solve this problem, Google introduced the support library. The bridge that connects the future with the past. All that important glittering stuff introduced in Honeycomb were stuffed into a library, named V4, shoved them to the developers.
After every new version of Android, the classes in the support library grew as well as its importance.
Here are a few of the key classes included in the v4 library:
- App Components
Fragment- Adds support for encapsulation of user interface and functionality with Fragments, enabling applications to provide layouts that adjust between small and large-screen devices.NotificationCompat- Adds support for rich notification features.LocalBroadcastManager- Allows applications to easily register for and receive intents within a single application without broadcasting them globally.
- User Interface
ViewPager- Adds aViewGroupthat manages the layout for the child views, which the user can swipe between.PagerTitleStrip- Adds a non-interactive title strip, that can be added as a child ofViewPager.PagerTabStrip- Adds a navigation widget for switching between paged views, that can also be used withViewPager.DrawerLayout- Adds support for creating a Navigation Drawer that can be pulled in from the edge of a window.SlidingPaneLayout- Adds widget for creating linked summary and detail views that appropriately adapt to various screen sizes.
- Accessibility
ExploreByTouchHelper- Adds a helper class for implementing accessibility support for custom views.AccessibilityEventCompat- Adds support forAccessibilityEvent. For more information about implementing accessibility, see Accessibility.AccessibilityNodeInfoCompat- Adds support forAccessibilityNodeInfo.AccessibilityNodeProviderCompat- Adds support forAccessibilityNodeProvider.AccessibilityDelegateCompat- Adds support forView.AccessibilityDelegate.
- Content
Loader- Adds support for asynchronous loading of data. The library also provides concrete implementations of this class, includingCursorLoaderandAsyncTaskLoader.FileProvider- Adds support for sharing of private files between applications.
There are many other APIs included in this library. For complete, detailed information about the v4 Support Library APIs, see the
android.support.v4 package in the API reference.