The new version of the Android Emulator has many new features. You can easily resize the emulator on screen, and there's better support for rotating the device. You can easily simulate many common user actions, including fingerprint and multitouch gestures, and you can test camera and many other kinds of input. The advanced features screen lets you set specfic geographic locations for testing mapping applications.
- [Voiceover] In Android Studio 2.0, the Android emulator has been enormously improved. It's a lot faster than it was before and starts up much more quickly and they're also a lot of great new features to let you manipulate the emulator and your virtual devices and test your apps features. When you see the emulator window, there are two separate emulator windows but they're tied to together. If you move the main window around, you'll see that the control bar snaps into place next to it and that's an expected behavior.
You can now resize the emulator window. I'll drag it up to the top of my screen and then click and drag the lower right hand corner down as far as I can go, and then when I release it, the virtual device display expands to fill the window, but the aspect ratio remains the same. In the original emulator you could change the orientation by pressing a keyboard shortcut. You can now rotate the emulator by clicking these buttons on the toolbar. There's a rotate left button, and a rotate right button.
With the old version of the emulator, there was only portrait and landscape, but you can now emulate upside down by clicking the left or right button twice, and notice that the skin now shows the control buttons at the top of the screen. This is a state in which you usually want to test your apps and you couldn't do this easily with the old emulator. To get it back to right side up, I'll click the left button twice again. Speaking of the control bar buttons, which appear on a Nexus device on the bottom of the screen as software buttons, you get those as well on the control bar.
Here's a back button, a home button, and an overview button. The overview button shows you your recent apps. You can either click those buttons or you can use the keyboard shortcuts and you can find out the keyboard shortcuts for your operating system by hovering the mouse over the button. If you click the three dots at the bottom of the control bar, you'll get to the extended control screen. Here you can control the virtual location of the device. You can control the emulation of the cell network, battery life, phone behavior, including emulating an incoming phone call, and SMS messages.
Emulating directional pad behavior and fingerprints. Here's an example, in the location screen, I've set a latitude and a longitude. I'll cancel out of the extended control screen and then I'll go back to my home screen. I'll click into the search screen and then I'll type maps and then I'll use my mouse and open up the Google maps application. This is the first time I've used it on this device. So I'll click Accept and Continue, and then I'll skip signing in.
Then I'll click the location button and when prompted I'll say yes I want to improve location accuracy. I start off in the middle of the ocean. Now I'll go back to the extended controls and I'll click the Send button. As that sends the current latitude and longitude that I've registered here to the device. I'll close the dialog and when I come back, I'm at the Googleplex in Mountain View, California. Now I'll open a browser and I'll go to Google maps and it shows me in Seattle where I record my courses.
I'll right click here and say What's here? And I get a useful latitude and longitude display down here. I'll select and copy the latitude, then I'll go back to my emulator. I'll go to my extended controls and I'll paste in that latitude, and I'll go back to my browser and I'll select and copy longitude, and if I have any trouble getting it from there, I can get it from the URL up here, and I'll paste that in and then once again I'll click Send and close the extended controls and then I'll click the location button in Google Maps and there I am in Seattle, Washington.
If I want to fake a phone call, I can go to the Phone tab and then put in a phone number and click call device and back on the device after a moment, I should receive a fake phone call. And there it is. I'll click Answer, and then I'll hang up. Now none of this will work exactly like it does on a physical device. For example, you might see dialogs that don't disappear when you expect them to, but with these new features you can do a lot more and a lot more easily then you could with the old version of the Android emulator.
- Installing Android Studio on Mac and Windows
- Creating Android Studio projects
- Setting up the development environment, including HAXM and the new Android emulator
- Importing existing code into Android Studio projects
- Exploring the interface, including the editor and project windows
- Managing project builds and dependencies
- Creating new Java classes
- Refactoring code
- Using templates
- Using breakpoints and watch expressions
- Updating apps with Instant Run
- Using Git for version control