Finding Answers in the Documentation
Google provides a wealth of documentation including reference materials, tutorials, design guidelines and so in the online Developers Documentation.
The reference section is separated into categories.
• Android platform provides information on the classes and components that are part of the core API. • Android Support Library provides information on components that are delivered separately. • AndroidX contains information on many of the same packages found in the Android Support Library, but here they are split into different packages that start with the phrase “AndroidX”.
The easiest way to find information relating to a specific class is to type that class name into the search box.
As an example, we might search for Activity which is one of the most important classes in the SDK and then click through to android.app.activity. From here, note that we can use a drop-down box to select different API levels. Currently the default (that is, the highest) is level 29 and I notice that the documentation also defaults to Java but allows you to switch to Kotlin.
For the API level, the main point to note here is that if you select an older level, you will filter out classes and components so you will only see those which are available for the level you have selected.
Note that this feature doesn’t appear in the Android Support Library because the support library works across all versions of Android.
To some degree, the documentation is directly accessible from within Android Studio. If you select a class or component that is part of the core SDK, you can press Shift and F1 and this will take you to the external documentation. This does not work so well for classes that are part of the Support Library or AndroidX and you will often find that if you press Shift and F2 here, you won’t get any response.
However, there is an alternative keyboard shortcut which will give you some documentation. If you select a component such as AppCompatActivity and press Control and Q, a pop up will appear showing you the package that this is a member of. Pressing it again opens a separate window, pressing it again moves to the other tab and pressing it again closes the window.
We can use this same shortcut for classes where we do have full documentation and we will see much more information and again, we can cycle through the views by repeating the key press.