Google provides extensive documentation that you can use to learn about the Android application framework and to look up specific Java classes from the Android SDK. Start the shortened url http://d.android.com. From there you can get to all of the documentation on the web from this page. You'll find training materials here under Training > API Guides, and critically for Java developers, the Reference. The Reference takes you to the Java docs for the entire SDK.
- [Instructor] Google provides extensive documentation that you can use to learn about the Android application framework and to look up specific Java classes from the Android SDK. You can get to all the documentation on the web from this page, at developer.android.com. From there, click on the Develop link and you'll find links over on the left to Training, to API Guides, and critically, to Reference. When you click on Reference, you're taken to the API docs. And this has documentation for everything that's a part of the Android Core SDK.
Now, in Android Development, you aren't just using SDK classes. You're also using classes from the Android Repository and the Google Repository. So, you sometimes you have to go searching for the documentation for various components. But a lot of it is centralized right here. Let's say for example, that I was looking for a particular class, like activity. I can click into the Search box and type Activity and I'd see everything listed over here. And I'd choose the particular class I was interested in.
And that would take me to all of the documentation. Now over on the left, there is a pull-down that shows you the API level you're looking at right now. The activity class has been a part of Android since the very beginning. So even if I go all the way back to API level eight, API level seven or even further, the activity class is still there. But notice over here in the classes list, that as I change to a different API level, an earlier one, that some of these classes are disabled.
And that means that those classes weren't a part of the API level I have currently selected. To see everything that's available in the current version of Android, that's API level 24 for Android 7, I would choose API level 24. Now, I mentioned that this documentation includes information about both classes that are a part of the Core SDK and about features of the support repositories. When you create a brand new application, typically you're using a class named AppCompatActivity.
That's a part of the support repository. You can tell by the package name, which starts by android.support. So I'm gong to select and copy the name of this class, then I'll search for it. And I find it and I can jump to it. So the documentation is there, you just have to know how to find it. If you know which package a particular class is in, but you don't remember the particular class name, you can search for the package. So for example, I might type android.database.
And that would take me to the particular package and from there I could find all of the interfaces, classes, enums and exceptions that are members of that package. There are a number of ways to get to documentation within the code editor. One way is to click on a particular identifier, a class or a method, and then press Control + Q on Windows or F1 on Mac. And that takes you to quick documentation. You can drag to expand the window and see more of that documentation and you can click on links in the documentation to see other information.
Another way of finding information about a class is to hold down the Control key on Windows or Command on Mac and then just move the cursor over the class name. And that will tell you some critical information, such as its inheritance hierarchy. AppCompatActivity is extended from FragmentActivity and it implements methods methods from a number of interfaces. You can then click into any of those super classes or interfaces to get more information. You can get even more documentation by clicking into certain class names and pressing Shift + F1.
This works pretty reliably for classes that are members of the Core SDK. I'll go to my imports and click into bundle, which is a critical class, and then press Shift + F1. And that's the same keyboard shortcut on both Windows and on Mac. And I jump to a browser and open up the documentation for that class. That trick isn't as reliable with classes that are a part of the support repository. It'll sometimes work and it sometimes won't. And in the customization of IntelliJ IDEA, that Android Studio is based on, Google has hidden a lot of the features that would let you configure those external documentation links.
So in my installation, if I click into AppCompatActivity, and press Shift + F1, nothing happens. There are ways of hacking that and configuring Android Studio, but it's not documented by Google and therefore, I don't consider those tricks reliable. So you have a lot of choices for getting some help. You can go through the quick documentation with Control + Q or F1, you can press Control or Command and move the mouse over a class or you can use the external documentation.
However you use it, it's important to get comfortable with the Java API docs that are a part of the Android SDK.
- Installing Android Studio
- Creating your first Android Studio project
- Managing profile files, including Gradle scripts and support libraries
- Defining screens with activities
- Implementing designs in XML layouts