To use the exercise files in this course, you’ll need the right versions of Android Studio and the Android SDK. The sample apps in this course were built with Android Studio 2.1. The apps all target API level 23 for the most recent production version of Android 6.0, Marshmallow. Building and testing these apps requires some more resources, all of which you can download from the SDK Manager or create in the AVD Manager.
- View Offline
- [Instructor] To follow along with the exercise files in this course, you'll need the right versions of Android Studio and the Android SDK. The sample apps in this course were built with Android Studio 2.1. They all target API level 23 for the most recent production version of Android, version 6.0 Marshmallow. For example, in this sample app, in the gradle script for the app module, I have my minimum SDK version set to 15, and the target and compile SDK versions both set to 23.
In order to build and run this application, you'll need certain components that you can download using the SDK Manager. I've downloaded Android 6.0 Marshmallow API 23 and Android 4.4 KitKat API level 19. I have that version so I can test using one of the older versions of Android that still has significant device market share. As of May 2016, Android 4.4 represented about 1/3 of the Android devices accessing the Google Play Store.
I'll be doing most of my testing on physical devices, but if you're using the emulator, you should also download the Google API's Atom system image for both API levels. To find out whether you've installed those, select the API level and click Show Package Details, and then take a look and make sure that you have the appropriate system image. That's the system image I've installed for API 23 Marshmallow, and this is the system image that I have installed for KitKat, Android 4.4.
In addition to those tools, under SDK tools, you'll want to have Build-Tools version 23.0.3. That's the version of the Build-Tools that's registered in all of the sample applications. Of course you'll also need to install Intel HAXM, the software that manages memory on Intel computers, which you can download from here. If you haven't installed HAXM before, you can learn more about it by watching the video, Create Virtual Devices For Testing in the course, Android App Development Essential Training.
After you've downloaded all of these SDK elements, you should create certain AVDs, or virtual devices, using the AVD Manager. Here are the AVDs that I've installed for this course. Now again I won't be using all of these during the demonstrations, because for the most part I'll be using physical devices, but I've installed images representing the most recent phone devices, the 5X and the 6P, and the Nexus 9 tablet.
Those are all running on API 23 for Marshmallow. I've also created a virtual device to represent the first generation Nexus 7 from 2012 and that's running on API 19 for Android 4.4 KitKat. That gives me a good range of screen sizes, resolutions, and operating system versions. Also, I've set the amount of memory for each of these devices under Advanced Settings to use only one gig of ram.
That's half a gigabyte less than the default when you create a new virtual device, but I do that so I can run multiple virtual devices simultaneously without running out of system memory. Notice I have not created virtual devices or downloaded API platforms for even older versions of Android, such as Android 2.3 Gingerbread. If you want to support those older versions, I recommend testing on a physical device rather than trying to use the Android Emulator.
I have a Motorola Droid 2 that I use for this purpose. Now even though this is a steadily stroking segment of the Android device market, it might be important to you. According to the Android Dashboards on the developer website, at developer.android.com/about/dashboards, as of May 2016, these older versions of Android held less than 3% of the market for devices that access the Google Play Store. You might decide to ignore that device segment, and it will greatly simplify your development and testing time, but for those who need to deal with the older devices, I'd recommend a physical device.
Once you've downloaded all of the SDK elements you'll need and created virtual devices for testing, you should be able to follow along as I demonstrate how to create flexible Android apps with the Fragments API.
- Configuring Android Studio
- Understanding fragments
- Creating a fragment class and layout
- Adding and removing fragments with Java
- Creating layouts for multiple screens
- Understanding arguments and callback methods
- Passing arguments to a fragment
- Choosing layout at runtime
- Displaying dialogs with fragments
- Using fragments for managing dialogs, shared preferences, and more