Tip

It is a good idea to keep the Emulator running, even after you are finished with your Activity and have returned to the code window. It is most people's instinct to close the Emulator window when they have finished testing their Activity. However, I have found that leaving the Emulator open helps with two major issues. The first is the amount of time it takes for the Emulator to start. By leaving the Emulator open, you avoid the lengthy load time. Second, I have noticed that there are times when I make minor changes to an Activity and they are not copied to the Emulator. Leaving the Emulator open seems to alleviate this issue as well. If you continue to have issues in the Emulator, remove the userdata-qemu.img file from your computer. This allows the Emulator to start up with a clean image.

If you have followed the code in the examples correctly, you should see the following:

ra s

As you can see, you have now opened the phone's Dialer Activity. The Dialer is displaying the phone number that you passed to it, 5551212. Using the Emulator, click the Send button, and the phone should now call 555-1212—virtually of course.

Just displaying the Dialer Activity is useful only if you want to create an application that allows the user to edit the number before calling it, or even confirm that they really want to make the call. What should you do if you want your application to actually place the call for you? The answer is addressed next.

0 0

Post a comment