Using the Android Developer Documentation

Android Lint errors will tell you what API level your incompatible code is from. But you can also find out which API level particular classes and functions belong to in Android’s developer documentation.

It is a good idea to get comfortable using the developer documentation right away. There is far too much in the Android SDKs to keep in your head. And, with new versions appearing regularly, you will need to learn what is new and how to use it.

The Android developer documentation is an excellent and voluminous source of information. The main page of the documentation is developer.android.com. It is split into six parts: Platform, Android Studio, Google Play, Android Jetpack, Docs, and News. It is all worth perusing when you get a chance. Each section outlines different aspects of Android development, from just getting started to deploying your app to the Play Store.

Platform

Information on the basic platform, focusing on the supported form factors and the different Android versions.

Android Studio

Articles on the IDE to help learn the different tools and workflows to make your life easier.

Google Play

Tips and tricks for deploying your apps as well as making your apps more successful with users.

Android Jetpack

Information about the Jetpack libraries and how the Android team is striving to improve the app development experience. Some of the Jetpack libraries are used in this book, but you should explore this section for the full list.

Docs

The main page for the developer documentation. Here you will find information on the individual classes in the framework as well as a trove of tutorials and codelabs that you can work through to improve and hone your skills.

News

Articles and posts to keep you up to date on the latest happenings in Android.

You can also download the documentation to access it offline. In Android Studio’s SDK Manager (ToolsSDK Manager), select the SDK Tools tab. Check Documentation for Android SDK and click Apply. You will be informed of the size of the download and asked to confirm. Once the download has finished, you can access the documentation on your filesystem. The directory where you downloaded the SDKs (which you can check in the SDK Manager, if you do not know it) will have a new docs directory that contains the complete documentation.

On the documentation website, determine what API level makeClipRevealAnimation(…) belongs to by searching for its name using the search bar at the top right. Select the ActivityOptions result (which is likely the first search result), and you will be taken to the class reference page shown in Figure 7.3. On the right side of this page are links to its different sections.

Figure 7.3  ActivityOptions reference page

ActivityOptions reference page

Scroll down, find the makeClipRevealAnimation(…) function, and click on the function name to see a description. To the right of the function signature, you can see that makeClipRevealAnimation(…) was introduced in API level 23.

If you want to see which ActivityOptions methods are available in, say, API level 21, you can filter the reference by API level. On the lefthand side of the page, where the classes are indexed by package, find where it says API level: 28. Click the adjacent control and select 21 from the list. Everything that Android has introduced after API level 21 will be grayed out.

The API level filter is much more useful for a class that is available at the API level that you are using. Search for the reference page on the Activity class in the documentation. Change the API level filter back down to API level 21 and notice that many methods are available at that level – though some have been added since that API, such as onMultiWindowModeChanged(…), which is an addition to the SDK in Nougat that allows you to be notified when the activity changes from full-screen mode to multi-window mode and vice versa.

As you continue through this book, visit the developer documentation often. You will certainly need the documentation to tackle the challenge exercises, but you should also explore it whenever you get curious about particular classes, functions, or other topics. Android is constantly updating and improving the documentation, so there is always something new to learn.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.147.252