03/09/2017
Android Apps for Absolute Beginners (4th Edition-English Version)
**********************************************************************
စာအုပ္နံမည္ကိုၾကည့္ရံဳနဲ႔ Android ဖုန္းေဆာ့၀ဲေတြကို ေရးသားဖန္တီးခ်င္ၾကသူေတြထဲက ဘာဆိုဘာမွ မသိေသးတဲ့ Beginner ေတြအတြက္ လံုး၀အသင့္ေတာ္ဆံုး စာအုပ္ဆိုတာကို သိႏိုင္ပါတယ္။
အမွန္တကယ္လည္း အေျခခံအက်ဆံုး အဆင့္ကေန ေရးသားတင္ျပထားတဲ့ အဂၤလိပ္ဘာသာနဲဲ႔ ထုတ္ေ၀ထားတဲ့စာအုပ္ေလး တစ္အုပ္ျဖစ္ပါတယ္။
Online Shopping ေတာ္ေတာ္မ်ားမ်ားမွာ e-book အျဖစ္နဲ႔ေတာင္ တစ္အုပ္ကို ၂၈ေဒၚလာ၀န္းက်င္နဲ႔ ေရာင္းအားေကာင္းေနဆဲ စာအုပ္တစ္အုပ္ျဖစ္ပါတယ္။
ဒီတစ္အုပ္ကေတာ့ အႀကိမ္ႀကိမ္ မြမ္းမံထုတ္ေ၀လာတဲ့ထဲက ေနာက္ဆံုးထြက္ 4th Edition ျဖစ္ပါတယ္။
၀ယ္ယူေလ့လာခ်င္တယ္ဆိုရင္ တစ္အုပ္ကို ၃၀၀၀ က်ပ္နဲ႔ ေရာင္းေပးမွာျဖစ္ပါတယ္။
ေမးျမန္းေဆြးေႏြးလိုတာရွိရင္ Chat Box ကေနျဖစ္ျဖစ္
09766700905 ကို ဖုန္းဆက္ၿပီးျဖစ္ျဖစ္ ေမးျမန္းေဆြးေႏြးႏိုင္ပါတယ္။
စာအုပ္ပါ Content ေတြကိုေတာ့ ေအာက္မွာေဖၚျပထားပါတယ္။
Chapter 1: Preliminary Information: Before We Get Started ........................... 1
Some History: What Is Android? ......................... 2
Advantage Android: How Can Android Benefit Me? .. 3
The Scope of This Book .. 4
What’s Covered .. 4
What’s Not Covered ... 5
Preparing for Liftoff: SDK Tools to Download . 5
Java ................... 6
Eclipse ............ 7
Android SDK ....... 8
Summary ... 8
■Chapter 2: What’s Next? Our Road Ahead .... 11
Your Android Development IDE ........... 11
Java, XML, and How Android Works ... 13
The Android Application Framework .... 14
Screen Layout Design ............ 14
User Interface Design ...... 15
Graphics and Animation Design ... 15
Interactivity ............. 16
Content Providers ........... 16
Intents and Intent Filters ....... 17
The Future of Android ....... 17
Summary .......................... 18
■Chapter 3: Setting Up Your Android Development Environment ................... 19
Installing Java, Eclipse, and Android ....... 19
Java SE and JRE: Your Foundation for Application Development .................................................................... 20
■ CONTENTS
vi
Eclipse IDE: The Development Environment ..... 21
Android SDK: The Android Tool Kit for Eclipse ......... 25
Android Development Tool: Android Tools for Eclipse ..... 26
The Android Environment Within Eclipse .... 30
Updating the Android SDK ........ 31
Setting Up AVDs and Smartphone Connections ..... 33
AVDs: Smartphone Emulators ....... 33
USB Smartphone Drivers: External Devices ............... 35
Developing on 64-Bit Computing Platforms .... 36
Summary .............. 38
■Chapter 4: Introducing the Android Software Development Platform ........... 41
Understanding Java SE and the Dalvik Virtual Machine ....................................................................................... 42
The Directory Structure of an Android Project ...................................................................................................... 43
Common Default Resources Folders ................................................................................................................ 44
The Values Folder ............................................................................................................................................ 45
Leveraging Android XML (Your Secret Weapon) ................................................................................................... 46
Screen Sizes .................................................................................................................................................... 47
Desktop Clocks ................................................................................................................................................ 47
Using Your Android Application Resources ........................................................................................................... 48
Bitmap Images ................................................................................................................................................. 48
Alternate Resource Folders .............................................................................................................................. 49
Launching Your Application: The AndroidManifest.xml File .................................................................................. 50
Creating Your First Android Application ................................................................................................................ 51
Launching Eclipse ............................................................................................................................................ 51
Creating an Android Project ............................................................................................................................. 52
Inspecting and Editing the Application Files .................................................................................................... 55
Setting a Variable Value in strings.xml ............................................................................................................ 59
Running the App .............................................................................................................................................. 60
Adding an Application Icon .............................................................................................................................. 61
Summary .............................................................................................................................................................. 65
■Chapter 5: Android Framework Overview ..................................................... 67
The Foundation of OOP: The Object ...................................................................................................................... 68
Some OOP Terminology ................................................................................................................................... 69
The Blueprint for an Object: The Class ............................................................................................................. 70
Providing Structure for Your Classes: Inheritance ........................................................................................... 75
Defining an Interface ....................................................................................................................................... 76
Bundling Classes in a Logical Way: The Package ............................................................................................ 77
An Overview of XML .............................................................................................................................................. 78
The Anatomy of an Android Application: The APK File .......................................................................................... 79
Android Application Components .......................................................................................................................... 80
Android Activities: Defining the UI ................................................................................................................... 81
Android Services: Processing in the Background ............................................................................................ 82
Broadcast Receivers: Announcements and Notifications ................................................................................ 82
Content Providers: Data Management ............................................................................................................. 83
Android Intent Objects: Messaging for Components ............................................................................................. 84
Android Manifest XML: Declaring Your Components ............................................................................................ 85
Summary .............................................................................................................................................................. 87
■ CONTENTS
vii
■Chapter 6: Screen Layout Design: Views and Layouts .................................. 89
Android View Hierarchies ...................................................................................................................................... 89
Using the View Class ........................................................................................................................................ 90
Nesting Views: Using the ViewGroup Class ..................................................................................................... 90
Defining Screen Layouts: Using XML .................................................................................................................... 92
Setting Up for Your Screen Layout ................................................................................................................... 92
Using Linear Layouts ........................................................................................................................................ 93
Using Relative Layouts ................................................................................................................................... 104
Sliding Drawers: Expanding Your UI .............................................................................................................. 108
Using Padding and Margins with Views and Layouts .................................................................................... 111
Setting Padding in Views ............................................................................................................................... 112
Setting Margins in ViewGroups ...................................................................................................................... 112
Summary ............................................................................................................................................................ 112
■Chapter 7: UI Design: Buttons, Menus, and Dialogs .................................... 115
Using Common UI Elements ................................................................................................................................ 115
Adding an Image Button to Your Layout ........................................................................................................ 116
Adding a Text to Your Layout ......................................................................................................................... 126
Adding an Image ............................................................................................................................................ 127
Using Menus in Android ...................................................................................................................................... 129
Creating the Menu Structure with XML .......................................................................................................... 130
Defining Menu Item Strings ........................................................................................................................... 131
Inflating the Menu Structure via Java ............................................................................................................ 134
Running the Application in the Android Emulator .......................................................................................... 136
Making the Menu Work .................................................................................................................................. 136
Adding Dialogs .................................................................................................................................................... 140
Using Custom Dialog Subclasses ................................................................................................................... 140
Displaying an Alert Dialog .............................................................................................................................. 140
Summary ............................................................................................................................................................ 145
■Chapter 8: An Introduction to Graphics Resources in Android ................... 147
Introducing the Drawables .................................................................................................................................. 148
Implementing Images .................................................................................................................................... 148
Core Drawable Subclasses ............................................................................................................................ 149
Using Bitmap Images in Android ......................................................................................................................... 149
PNG Images ................................................................................................................................................... 150
JPEG and GIF Images ..................................................................................................................................... 151
Creating Animation in Android ............................................................................................................................ 151
Frame-based or Cel 2D Animation ................................................................................................................. 151
Tween Animation in Android .......................................................................................................................... 160
Using Transitions ................................................................................................................................................ 166
Creating 9-Patch Custom Scalable Images ......................................................................................................... 170
Playing Video in Your Android Apps .................................................................................................................... 176
Adding a VideoView Object ............................................................................................................................ 176
Adding the Java for Video .............................................................................................................................. 178
Summary ............................................................................................................................................................ 181
■Chapter 9: Adding Interactivity: Handling UI Events ................................... 183
An Overview of UI Events in Android ................................................................................................................... 183
Listening for and Handling Events ................................................................................................................. 183
■ CONTENTS
viii
Handling UI Events via the View Class ........................................................................................................... 184
Event Callback Methods ................................................................................................................................ 184
Handling onClick Events ..................................................................................................................................... 185
Implementing an onClick Listener for a UI Element ....................................................................................... 186
Adding an onClick Listener to an Activity in Android ..................................................................................... 187
Android Touchscreen Events: onTouch ............................................................................................................... 195
Touchscreen’s Right-Click Equivalent: onLongClick ........................................................................................... 195
Keyboard Event Listeners: onKeyUp and onKeyDown ........................................................................................ 198
Adding the XML for Keyboard Events ............................................................................................................. 199
Adding the Java for Keyboard Events ............................................................................................................ 199
Context Menus in Android: onCreateContextMenu ............................................................................................. 202
Adding the XML for Context Menus ............................................................................................................... 202
Adding the Java for Context Menus ............................................................................................................... 204
Controlling the Focus in Android ......................................................................................................................... 209
Adding the XML for Focus Control ................................................................................................................. 210
Adding the Java for Focus Control ................................................................................................................. 214
Setting Focus Availability ............................................................................................................................... 216
Summary ............................................................................................................................................................ 216
■Chapter 10: Understanding Content Providers ............................................ 217
An Overview of Android Content Providers ......................................................................................................... 217
Databases and Database Management Systems ........................................................................................... 218
Android Built-in Content Providers ................................................................................................................ 219
Defining a Content Provider ................................................................................................................................ 222
Creating the Content Providers Example Project in Eclipse ........................................................................... 223
Defining Security Permissions ....................................................................................................................... 224
Adding Data to the Contacts Database .......................................................................................................... 228
Working with a Database .................................................................................................................................... 231
Querying a Content Provider: Accessing the Content .................................................................................... 231
Appending to a Content Provider: Adding New Content ................................................................................. 237
Modifying Content Provider Data: Updating the Content ............................................................................... 243
Removing Content Provider Data: Deleting Content ...................................................................................... 248
Summary ............................................................................................................................................................ 253
■Chapter 11: Understanding Intents and Intent Filters ................................. 255
What Is an Intent? ............................................................................................................................................... 255
Android Intent Messaging via Intent Objects ...................................................................................................... 256
Intent Resolution: Implicit Intents & Explicit Intents ........................................................................................... 259
Explicit Intents ............................................................................................................................................... 259
Implicit Intents ............................................................................................................................................... 260
Using Intents with Activities ............................................................................................................................... 261
Writing the Digital Clock Activity .................................................................................................................... 266
Wiring up the Application ............................................................................................................................... 269
Sending Intents .............................................................................................................................................. 271
Android Services: Data Processing in its own Class ........................................................................................... 274
Using Intents with Services ........................................................................................................................... 274
Creating a Service .......................................................................................................................................... 277
Implementing Our MediaPlayer Functions ..................................................................................................... 281
Wiring the Buttons to the Service .................................................................................................................. 282
■ CONTENTS
ix
Running the Application ................................................................................................................................. 283
Using Intents with Broadcast Receivers ............................................................................................................. 284
Creating the Timer User Interface via XML .................................................................................................... 285
Creating a Timer Broadcast Receiver ............................................................................................................ 286
Configuring the AndroidManifest.xml file Tag ............................................................................. 288
Implementing our Intent ................................................................................................................................ 289
Running the Timer Application via the Android 1.5 Emulator ........................................................................ 294
Summary ............................................................................................................................................................ 295
■Chapter 12: The Future ................................................................................ 297
Widgets: Creating Your Own Widgets in Android ................................................................................................ 297
Location-Based Services in Android ................................................................................................................... 299
Google Maps in Android ...................................................................................................................................... 300
Google Search in Android ................................................................................................................................... 303
Data Storage in Android ...................................................................................................................................... 304
Shared Preferences ....................................................................................................................................... 304
Internal Memory ............................................................................................................................................. 305
External Memory ............................................................................................................................................ 305
Using SQLite ................................................................................................................................................... 306
Device Administration: Security for IT Deployments ........................................................................................... 306
Using the Android Camera Class to control a Camera ........................................................................................ 307
3D Graphics: Using OpenGL ES 1.x in Android .................................................................................................... 307
FaceDetector ....................................................................................................................................................... 308
SoundPool ........................................................................................................................................................... 308
MediaRecorder .................................................................................................................................................... 309
Summary ............................................................................................................................................................ 310
Index ............................................................................................................... 311