We believe that the Android 3.0 tablet operating system was officially launched on February 22, 2011 In the US time, and the implication for Android mobile app developers is:
Previously developed Android phone applications, in addition to running on Android smartphone system, but also because of the Android 3.0 tablet operating system backwards compatibility, This allows Android mobile apps to span new areas of Android tablet OS.
However, Android officials think this is not enough!
If the application developed for Android 3.0 Tablet OS is compatible with other Android smartphone operating systems, then the vast territory of the Android app development market can be truly opened.
But, here's the problem!
The Android 3.0 SDK has many APIs developed specifically for the tablet user interface, and these new APIs are not defined in the current Android smartphone operating system.
Unless, for every Android smartphone, users have a way to download updates to the API used in the Android 3.0 SDK, these Android tablet apps will only look at the heart of the Android smartphone!
However, a comprehensive update of Android smartphone system version, easy!
The dilemma lies in the openness of Android.
Because, the current global market for Android smartphones from Android 1.6, Android 2.1, Android 2.2, and even Android 2.3, what version of Android smartphones are available.
Plus, different Android smartphone makers seem to change the system content themselves in order to create their own product differences. The goal of making Android tablet apps compatible with Android smartphone systems is very difficult to achieve in the short term.
What about that?
Android official came up with a good idea!
What is the Android compatibility package?
They launched an Android compatibility kit called the Android Compatibility package on March 3, 2011.
Android mobile app developers can download and install the Android compatibility package via the Android SDK and AVD Manager tool software.
As for what is the purpose of the Android compatibility package?
Its main function is that the Android compatibility package has a Android-support-v4.jar compression pack. (Note: the. jar package format full name is Java Archive, for Java program developers to use the JDK provided by the JAR Package Compression tool (Jar.exe), a number of Java class files (. class) compressed format. )
This package compresses some API class files for Android 3.0.
Among them, it mainly includes fragments, Loadermanager and other Android 3.0 related API class files. (Note: Android-support-v4.jar's detailed API class file listing, as shown)
Android mobile app developers can place Android-support-v4.jar into their own Android mobile app and become its static library.
This static function library can be compressed into a single Android installation file (the. apk,android application package) with the Android phone app's original code for download and installation.
When the Android smartphone executes some of the Android 3.0 API code in the app, it can take the Android 3.0 related API class directly from this static function library to execute some of the program code that was originally available on Android 3.0.
So, we think that the emergence of the Android compatibility package is indeed the unified of the Android application territory, revealing a glimmer of light.
However, it has a very important limitation, that is, Android compatibility package currently only supports Android 1.6 (including) Android smartphone system version. Earlier versions were not able to use the static library of functions provided by the suite.
Speaking of which, you must not be anxious to download and install the Android compatibility package?
We would like to stress in particular that this article will only cover the download and installation steps of the Android compatibility package.
How do you write the full program code that uses fragments, Loadermanager, or other Android 3.0-related APIs?
Because of the length of our space, we will continue to publish them in future teaching.
Download and install the Android compatibility package
Below, we begin to teach you how to download and install the Android compatibility package by means of graphic instructions.
First, please open the Eclipse IDE.
Also, please select the Android SDK and AVD Manager option in the Windows drop-down menu in the Eclipse IDE. To open the Android SDK and AVD Manager tool program. (as shown on the red box)
When the Android SDK and AVD Manager dialog box appears, click the Available Packages tab on the left side of the dialog box. (as shown on the red box)
Available packages detection can be downloaded in the kit .... (as shown)
When the Available Packages Child dialog box appears on the right side of the Android SDK and AVD Manager dialog box.
In the packages available for download check box, click the > icon in front of the Android Repository option. (as shown in Arrow 1)
The Android Repository option's sub-option will appear in Android Compatibility package, Revision 1 o'clock, please tick this sub-option directly. (as shown in Arrow 2)
Finally, please press the Install Selected button. (as shown in Arrow 3)
When you see the Choose Packages to Install dialog box, select the Accept option in the dialog box and press the Install button. (as indicated by arrows 1 and Arrows 2)
Android compatibility package is downloading ... ^_^ (as shown)
Android compatibility package Download complete!
Please press the Close button in the Installing Archives dialog box. (as shown on the red box)
When you go back to the Android SDK and AVD Manager dialog box, you can press the installed Packages tab on the left side of the dialog box to check if the Android compatibility package has been downloaded and installed successfully?. (as shown in Arrow 1)
After you press the installed Packages tab, it lists the list of various Android SDK related packages that you have installed on the right side of the Android SDK and AVD Manager dialog box.
At this point, you should see the Android Compatibility Package, Revision 1 project in this list, and if so you have successfully downloaded the Android compatibility. (as shown in Arrow 2)
When you are sure that the Android compatibility package has been successfully downloaded, press the X button in the upper-right corner of the Android SDK and AVD Manager dialog box to close the dialog box. (as shown in Arrow 3)
Android-support-v4.jar Importing Android Projects
You will then need to place the Android-support-v4.jar in the Android compatibility package in your Android project that will use the Android 3.0 SDK-related APIs.
However, before you place Android-support-v4.jar, you also need to add a new Android-support-v4.jar folder to the Android Project Libs.
So, in the Project Explorer Sub-window, click the Android project name. (as shown in Arrow 1)
Also, please right click on the name of this project. In the pop-up box, click the folder sub-option in the new option. (As indicated by arrows 2 and Arrows 3)
When the New Folder dialog box appears, enter Libs in the folder Name text entry box in the dialog box. (as shown in Arrow 1)
Then, press the Finish button. (as shown in Arrow 2)
At this point, you'll see a subfolder named Libs in the Android project.
Please click on this Libs folder to press the right mouse button. (as shown in Arrow 1)
When the pop-up box appears, click the Import option. To import Android-support-v4.jar into the Libs folder. (as shown in Arrow 2)
When you see the Import dialog box, in the function bar of the dialog box, click the File System sub-option in the General option. (as shown in Arrow 1)
And, please press Next > button. (as shown in Arrow 2)
You will then see an Import dialog box that lets you choose which file to import.
Please press the Browse in the dialog box ... Button. (as shown in Arrow 1)
When the Import from Directory dialog box appears, click the entity path where Android-support-v4.jar is located.
In general, if you use the default installation path of the Android SDK, the Android-support-v4.jar file should be installed in C:\Program files\android\android-sdk-windows\ Among the extras\android\compatibility\v4.
If you are also using this preset installation path, select the V4 subfolder in this dialog box according to the path. (as shown in Arrow 1)
Also, please press the OK button. (as shown in Arrow 2)
When you return to the Import dialog box, open the V4 folder on the left side of the dialog box. And on the right side of the dialog box, tick the Android-support-v4.jar name in the V4 folder. (as shown in Arrow 1)
Please note here: Because, we only need android-support-v4.jar, so please do not tick the V4 folder name on the left side of the dialog box.
Finally, please press the Finish button. (as shown in Arrow 2)
Project References for Android-support-v4.jar
At this point, you see Android-support-v4.jar successfully imported under the Libs folder.
However, in addition to importing Android-support-v4.jar into the Libs folder, you will also need to set the build path of the Android-support-v4.jar.
This makes it possible for Android projects to properly incorporate the Android 3.0-related APIs provided by Android-support-v4.jar when compiled by the compiler.
So, please click the Android-support-v4.jar name in the Project Explorer window to press the right mouse button. (as shown in Arrow 1)
When the popup box appears, please click the Add to build path sub-option in the Build path option. (As indicated by arrows 2 and Arrows 3)
Android-support-v4.jar build path is set successfully! (as shown on the red box)
Android-support-v4.jar contains quite a few API classes for Android 3.0. (as shown)
Import android.support.v4.*;
When you write the relevant API program code to Android 3.0, you just need to press the CTRL + Shift + O button on your keyboard at the same time, and eclipse will automatically add the program code for the API class that imports Android-support-v4.jar. (as shown on the red box)
However, we would like to remind you that: Android-support-v4.jar is not support all the Android 3.0 related API Oh!
As for, how to write apps on Android 3.0 related phones or tablets?
We will continue to publish the Android 3.0 related teaching articles in the future, you are welcome to read this lab's Android teaching handouts for a long time, thank you!