Beginning Android Application Development
Beginning Android Application Development
ISBN: 978-1-118-01711-1 March 2011 448 Pages
The Android OS is a popular and flexible platform for many of today's most in-demand mobile devices. This full-color guide offers you a hands-on introduction to creating Android applications for the latest mobile devices. Veteran author Wei Meng Lee accompanies each lesson with real-world examples to drive home the content he covers. Beginning with an overview of core Android features and tools, he moves at a steady pace while teaching everything you need to know to successfully develop your own Android applications.
- Explains what an activity is and reviews its lifecycle
- Zeroes in on customizing activities by applying styles and themes
- Looks at the components of a screen, including LinearLayout, AbsoluteLayout, and RelativeLayout, among others
- Details ways to adapt to different screen sizes and adjust display orientation
- Reviews the variety of views such as TextView, ProgressBar, TimePicker, and more
Beginning Android Application Development pares down the most essential steps you need to know so you can start creating Android applications today.
Table of contents
GETTING STARTED W CHAPTER 1: ITH ANDROID PROGRAMMING 1
CHAPTER 2: ACTIVITIES AND INTENTS 27
CHAPTER 3: GETTING TO KNOW THE ANDROID USER INTERFACE 81
CHAPTER 4: DESIGNING YOUR USER INTERFACE USING VIEWS 125
CHAPTER 5: DISPLAYING PICTURES AND MENUS WITH VIEWS 169
CHAPTER 6: DATA PERSISTENCE 203
CHAPTER 7: CONTENT PROVIDERS 237
CHAPTER 8: MESSAGING AND NETWORKING 263
CHAPTER 9: LOCATION-BASED SERVICES 301
CHAPTER 10: DEVELOPING ANDROID SERVICES 331
CHAPTER 11: PUBLISHING ANDROID APPLICATIONS 359
APPENDIX A: USING ECLIPSE FOR ANDROID DEVELOPMENT 381
APPENDIX B: USING THE ANDROID EMULATOR 393
APPENDIX C: ANSWERS TO EXERCISES 411
|2||35-36||Error in Code|
|50||Error in Code|
"Using the same project created in the previous section, add the following statements in bold to the main.xml file:"
This should be "activity2.xml" instead "main.xml"
|54||Error in Code|
It should say:
The code will still work, since request_Code = 1, but it is better to use the constant.
|119||Error in Code|
this line must be bolded:
The text just below Figure 4-5 reads as follows:
"The ToogleButton displays..."
it should be:
"The ToggleButton displays..."
|144||Error in Text|
Title for the Try it Out currently reads "Using the TimePicker Wiew"
Should read "Using the TimePicker View"
|151, 153||Error in Code|
In the code in bold towards the bottom it says:
"Date selected:" + datePicker.getMonth() + 1 + ..... etc.
It should be:
"Date selected:" + (datePicker.getMonth() + 1) + .... etc
This will ensure that the "1" is added; otherwise the output looks like this (assuming the month of June (5) is picked: 51/1/11
With the fix above it will show: 6/1/11
Also on pg 153 in the "how it works" section.
|159||Errors in Code|
This line: setContentView(R.layout.main);
commented out, like this:
Instead of using constants 0, 1 and 2, like this: lstView.setChoiceMode(2); //CHOICE_MODE_MULTIPLE You could also use: lstView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
Should be bold.
Add step between Step 1 and 2: Add the following <Button> element to the main.xml file:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <Button android:id="@+id/btn1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Tap and hold this for more options..." /> </LinearLayout>
|5||187||Error in Menu Definition|
The "Menus" application has the following menus defined:
menu.add(0,3,3, "Item 5");
menu.add(0,3,3, "Item 6");
menu.add(0,3,3, "Item 7");
This causes menus 5-7 to display
"You clicked on Item 4"
Should instead be:
menu.add(0,4,4, "Item 5");
menu.add(0,5,5, "Item 6");
menu.add(0,6,6, "Item 7");
Insert the line:
<uses-permission android:name="android.permission.INTERNET" />
in the manifest tag to make webview work.
|270||Error in Code|
Inside the Note box, SMS_SEND should read SEND_SMS.
|273||Error in Text|
Try It Out title should be "Updating an Activity When a SMS is Received"
|278||Error in Code|
"onDestroy()" method is invoked and the super.onPause() method is called before exiting
"super.onPause()" method should be "super.onDestroy()" method
|279||Error in Text|
Step 3 of the Try It Out:
|286||Error in Text|
Try It Out title should be "Downloading Images"
|287,297||Error in Code|
On page 287, the URL for the image: "http://www.streetcar.org/mim/cable/images/cable-01.jpg" is no longer valid.
Replace URL with: "http://www.mayoff.com/5-01cablecarDCP01934.jpg"
The same applies to the URL on page 297.
|302||Error in Figure|
The figure should select Google APIs.
|9||306||Error in Code|
Step 2, main.xml should be AndroidManifest.xml.
|9||322||Error in Code|
You need to add in the following permissions in order for your application to receive location coordinates:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOC ATION">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCAT ION">
|338||Error in Code|
This line must be bolded: