The complete handout for Android/OPhone development has been published and the source code is now available for download.

Source: Internet
Author: User
The complete handout for Android/OPhone development has been published.

Purchase: China-pub)

Sample chapter download

The source code of this book is now fully open

Android-OPhone-src.zipAndroid/OPhone development handout source code
Downloads: 82 hours ago

Directory
Preface
Chapter 2 Android Entry 1
1.1 Basic concepts of Android 1
1.1.1 introduction to Android 1
1.1.2 Android system architecture 3
1.2 build an Android development environment 4
1.2.1 What do Android programs need? 4
1.2.2 install Android SDK 4
1.2.3 install the Eclipse plug-in ADT 5
1.2.4 test whether ADT is successfully installed
1.3 Common command line tools in Android SDK 7
1.3.1 start and close the ADB Service (adb start-server and adb kill-server) 7
1.3.2 query the current simulator/device instance (adb devices) 7
1.3.3 install, uninstall, and run programs (adb install, adb uninstall, and am) 7
1.3.4 switch files between the PC and the simulator or the real machine (adb pull and adb push) 8
1.3.5 Shell command 8
1.3.6 create, delete, and browse AVD devices (android) 9
1.3.7 create SD card 9
1.4 Android 9 on PC
1.4.1 Android LiveCD 10
. 1.4.2 AndroidX86 10
1.5 Android learning resources 11
1.6 App Store 11
1.6.1 Android Market 11
1.6.2 Mobile Market (MM) 11
1.6.3 other app stores 12
1.7 Chapter 12
Chapter 1 first Android program 13
2.1 compile a program to display the current date and time 13
2.1.1 create an Android project 13
2.2.2 layout of interface components 14
2.2.3 compile the actual Code 14
2.2 debugging program 17
2.3 sign and publish an application 17
2.3.1 use the command line method for signature 18
2.3.2 use the ADT plug-in for signature 18
2.4 DDMS perspective 19
2.5 Chapter 20
Chapter 2 Android Application Architecture 21
3.1 resources in Android applications 21
3.1.1 where resources are stored 21
3.1.2 types of resources 21
3.1.3 Basic resource usage 22
3.2 Android Application Component 23
3.2.1 Activity component 23
3.2.2 Service component 23
3.2.3 Broadcast receiver (Broadcast receivers) component 24
3.2.4 Content provider component 24
3.3 AndroidManifest. xml file structure 24
3.5 Chapter 25
Chapter 2 user interface creation 26
4.1 create, configure, and use Activity 26
4.1.1 create and configure Activity 26
4.1.2 Activity lifecycle 28
Example 1: demonstrate Activity lifecycle 29
4.2 View 31
4.2.1 view Introduction 32
4.2.2 use XML layout file control view 32
4.2.3 control view 33 in code
Example 2: Control view 35 by using XML layout file and code together
4.2.4 three methods for customizing widgets 37
Example 3: custom components-TextView 37 with images
Example 4: custom components-EditText 40 with text labels
Example 5: custom components-pointer clock with replaceable dial 42
4.3 create a dialog box using the AlertDialog class 47
4.3.1 AlertDialog class Introduction 47
4.3.2 Confirmation/Cancellation dialog box 47
Instance 6: create a file
Confirmation/Cancellation Dialog Box 48
4.3.3 dialog box 49 with three buttons
Instance 7: Create overwrite/ignore/cancel dialog box 49
4.3.4 simple List dialog box 50
4.3.5 radio List dialog box 51
4.3.6 multiple choice List dialog box 51
Instance 8: create a list of three provinces dialog box 52
4.3.7 horizontal progress dialog box and circular progress dialog box 56
Instance 9: horizontal progress dialog box and circular progress dialog box 56
4.3.8 custom dialog box 59
Instance 10: logon creation dialog box 59
Example 11: use Activity hosting dialog box 61
Example 12: Create a dialog box that can be closed when you touch any location 62
4.4 Toast and Notification 65
4.4.1 use Toast to display the prompt box 65
4.4.2 Notification and status bar 66
4.5 menu 68
4.5.1 create option menu 68
4.5.2 set the image and Activity associated with the menu item 69
4.5.3 three methods for clicking an event in the response option menu item 69
4.5.4 dynamically add, modify, and delete option menu 70
4.5.5 create a sub-menu 71 with check boxes and option buttons
4.5.6 create context menu 72
4.5.7 menu event 73
Instance 13: Activity menu, sub menu, up/down
Text menu demonstration 73
4.6 layout 74
4.6.1 framework layout (FrameLayout) 74
Example 14: TextView 75 with neon Effect
4.6.2 LinearLayout 76
Example 15: Use LinearLayout to place the button at the four corners and center of the screen 78
4.6.3 relative layout (RelativeLayout) 79
Example 16: Use RelativeLayout to achieve plum blossom effect layout 79
4.6.4 TableLayout 80
Instance 17: calculator button layout 80
4.6.5 absolute layout (AbsoluteLayout) 81
4.7 Chapter 81
Chapter 2 component details 82
5.1 text display and editing components 82
5.1.1 text display component: TextView 83
Example 18: display URL, text of different font sizes, and different colors in TextView 84
Example 19: TextView 86 with borders
5.1.2 input text component: EditText 87
Instance 20: enter a specific character 88 in EditText
Instance 21: Press enter to display EditText 89
5.1.3 automatically complete the input content component: AutoCompleteTextView 90
5.2 button and check box component 91
5.2.1 common Button component: Button 91
Instance 22: shaped (circle, pentagram, spiral, arrow) button 92
5.2.2 image button component: ImageButton 93
Example 23: buttons for displaying images and text at the same time 94
5.2.3 Option Button component: RadioButton 94
5.2.4 Switch Status button component: ToggleButton 95
5.2.5 check box component: CheckBox 95
Instance 24: Use the XML layout file to dynamically create CheckBox 96
5.3 Date and Time component 98
5.3.1 input date component: DatePicker 98
5.3.2 input time component: TimePicker 98
Instance 25: DatePicker, TimePicker, and TextView
Synchronous Display Date and Time 98
5.3.3 components for clock display: AnalogClock and DigitalClock 99
5.4 progress bar component 100
5.4.1 progress bar component: ProgressBar 100
5.4.2 drag component: SeekBar 101
Instance 26: Change ProgressBar and SeekBar
Color 102
5.4.3 rating component: RatingBar 103
5.5 other important components 104
5.5.1 Image Display component: ImageView 104
Example 27: The ImageView component 105 in the specified area of the image is displayed.
Instance 28: dynamically scale and rotate images 106
5.5.2 list component: ListView 107
Instance 29: select one or more ListView 109
Instance 30: add or delete a ListView dynamically
List item 110
Instance 31: the background color of the selected ListView list item is changed to 113.
5.5.3 encapsulate the ListView Activity: ListActivity 114
Instance 32: Use SimpleAdapter to create a complex list item 114
Instance 33: rate the application by 115
5.5.4 The list component ExpandableListView 118 can be expanded.
5.5.5 drop-down list component: Spinner 119
5.5.6 vertical scroll view component: ScrollView 121
5.5.7 Horizontal scroll view component: Horizontal-ScrollView 121
Instance 34: View 122 that can be vertically and horizontally rolled
5.5.8 grid view component: GridView 122
5.5.9 components that can be cyclically displayed and switched to images: Gallery and ImageSwitcher 123
5.5.10 tag component: TabHost 125
5.6 summary of this chapter 126
Chapter 2 mobile storage solution 6th
6.1 simplest data storage method: SharedPreferences 127
6.1.1 using SharedPreferences to access data 127
6.1.2 data storage location and format 129
Instance 35: Access 129 of complex data types
6.1.3 set the data file access permission 131
6.1.4 you can save the set Activity -- PreferenceActivity 132
6.2 file storage 135
6.2.1 openFileOutput and openFileInput Methods 135
Example 36: SD card file browser 136
Example 37: Access image 140 in the SD card
6.2.2 how the SAX engine reads XML files 141
Instance 38: Convert XML data to Java object 142
6.4 SQLite database 145
6.4.1 SQLite database management tool 145
6.4.2 create a database and a table 146
6.4.3 fuzzy query 147
6.4.4 display records on pages 147
6.4.5 transaction 147
6.5 using SQLite database 147 in Android
6.5.1 SQLiteOpenHelper class and automatic Database Upgrade 148
6.5.2 SimpleCursorAdapter class and Data Binding 148
Example 39: Contact Management System with photos 151
6.5.3 Release Database and application together 154
Example 40: English dictionary 154
6.6 abstract standard-content provider 157
6.6.1 obtain 157 System Data
Instance 41: integrate contact management and English dictionary into your own application 158
6.7 summary of this Chapter 163
Chapter 4 Communications between applications 7th
7.1 Intent and Activity 164
7.1.1 start the Activity with Intent and
Transfer Data between 164
7.1.2 call Activity in other applications (call, browse webpages, send emails, etc.) 167
7.1.3 customize your own Activity Action 170
Example 42: Share the query function of an electronic dictionary into an Activity Action 172
7.2 receive and send broadcast 173
7.2.1 receive system broadcast 173
Instance 43: 174 of automatically running programs
Instance 44: What should I do if I receive a text message 174?
Instance 45: displays 176 of the current battery of the mobile phone.
7.2.2 send broadcast 177 in your own application
Instance 46: add contact broadcast 178 sent by the receiving Contact System
7.3 summary of this Chapter 179
Chapter 2 Android services 8th
8.1 Service started 180
8.1.1 Service lifecycle 180
8.1.2 bind Activity and Service 183
8.1.3 enable Service 185 in BroadcastReceiver
8.2 System Service 186
8.2.1 obtain system service 186
Instance 47: Listen for phone calls 187
Instance 48: Incoming call blacklist 188
8.2.2 simulate gravity sensing 189 on the simulator
Instance 49: Phone flip mute 190
8.3 Time Service 192
8.3.1 Timer: Chronometer 192
8.3.2 schedule Handler 194
8.3.3 Timer 195
8.3.4 update the GUI Component 196 in the thread
8.3.5 global timer AlarmManager 198
Instance 50: Regular wallpaper replacement 199
Instance 51: Multiple timed reminders 201
8.4 cross-process access (AIDL Service) 203
8.4.1 what is AIDL service 204
8.4.2 create an AIDL service step 204
Instance 52: Set up AIDL service 204
Instance 53: AIDL service for transmitting complex data 207
8.5 summary of this Chapter 211
Chapter 2 network 9th
9.1 components that can load network data 212
Instance 54: load the network image to the ListView component 213
Example 55: Google image Gallery (Gallery) 215
9.2 WebView component 219
9.2.1 use WebView components to browse Web page 219
Instance 56: mobile browser 219
9.2.2 use the WebView component to load HTML code 220
Example 57: Integrate the English dictionary into the web page (JavaScript calls the Java method) 222
9.3 access HTTP resource 223
9.3.1 submit http get and HTTP POST
Request 223
9.3.2 HttpURLConnection class 225
Instance 58: Upload File 226
Instance 59: Remote Apk installer 229
9.3.3 WebService 230 call
Instance 60: Query product information 231 through WebService
9.4 summary of this chapter 234
Chapter 2 multimedia 10th
10.1 graphics 235
10.1.1 basics of drawing 235
Example 61: draw basic graphics and text 237
10.1.2 draw a bitmap 241
Example 62: Draw bitmap 241 in two ways
10.1.3 set the color transparency 242
Instance 63: bitmap 243 that can change the transparency at will
10.1.4 rotating image 244
Instance 64: rotate the animation 244
10.1.5 distorted image 245
Example 65: image distortion by circular track 246
10.1.6 stretch image 249
Example 66: Image stretching demonstration 249
10.1.7 path 251
Instance 67: Draw text 254 along the path
Example 68: drawing board 256 on Images
10.2 audio and video 260
10.2.1 use MediaPlayer to play MP3 file 260
10.2.2 use MediaRecorder to record 261
10.2.3 use VideoView to play video 262
10.2.4 use SurfaceView to play video 262
10.3 Summary of this Chapter 263
Chapter 2 2D animation 11th
11.1 Frame Animation 264
AnimationDrawable and Frame Animation 264
Example 69: Play GIF animation 266 through Frame Animation
Instance 70: a subset of Video Frames played at 268.
11.2 Tween animation 270
11.2.1 Motion Compensation animation 270
Example 71: cyclically move the EditText to the right and the bounce ball 272
11.2.2 zoom in/out animation 274
Instance 72: beating heart 274
11.2.3 rotation compensation animation 276
Example 73: rotating galaxy 276
11.2.4 transparency compensation animation 277
Example 74: bomb throwing 278
11.2.5 vibration effect 280
11.2.6 Custom Animation Renderer (Interceptor) 281
11.2.7 ViewFlipper 282
11.3 Summary of this chapter 284
Chapter 2 OpenGL ES programming 12th
12.1 OpenGL introduction 285
12.2 construct the basic development framework of OpenGL ES 286
12.3 2D drawing 287
12.3.1 polygon 287
12.3.2 color 289
12.3.3 rotate 290
12.4 3D drawing 291
12.4.1 rotating cube 291
12.4.2 display texture 292 on the cube
12.4.3 cube 293 under illumination
12.4.4 transparent cube 295
12.5 summary of this chapter 295
Chapter 2 resources, internationalization and adaptability 13th
13.1 resources in Android 296
13.1.1 how to store resources in Android 297
13.1.2 297 types of resources
13.1.3 resource file name 298
13.2 define and use resources 298
13.2.1 Use System Resources 298
13.2.2 String (String) Resources 299
13.2.3 Array (Array) Resources 300
13.2.4 Color Resource 302
13.2.5 Dimension (Dimension) Resource 303
13.2.6 type (Style) resources 304
13.2.7 Theme resources 305
13.2.8 drawing resources 306
13.2.9 Animation resources 307
13.2.10 Menu resource 307
13.2.11 Layout resources 310
13.2.12 Attribute resource 310
Instance 75: improved the IconTextView component 312 that can display icons.
13.2.13 XML resource 313
13.2.14 RAW resources 314
13.2.15 ASSETS resource 314
13.3 internationalization and Resource Adaptation 315
13.3.1 internationalize resources 315
13.3.2 Locale and internationalization 317
13.3.3 commonly used resource configuration 317
13.4 summary of this Chapter 318
Chapter 1 hardware access to Android 14th
14.1 test hardware on mobile phone 319
14.1.1 install Android USB driver 319
14.1.2 test program on mobile phone 321
14.1.3 debug program 321 on mobile phone
14.2 recording 322
14.3 control mobile phone camera (photo taking) 323
14.3.1 call the system's photo taking function 323
14.3.2 implement your own photo taking Activity 325
14.4 application of sensors in mobile phones 329
Example 76: Electronic Compass 330
Instance 77: Pedometer 331
14.5 GPS and map positioning 332
14.5.1 Google GEO 333
14.5.2 use GPS to locate the current location 336
14.6 WIFI 337
14.7 summary of this chapter 339
Chapter 1 gadgets on the desktop 15th
15.1 widgets 340
15.1.1 add App Widget 340 to the Android Desktop
15.1.2 step 341 of App Widget Development
Instance 78: Digital Clock 343
15.1.3 AppWidgetProvider class 345
15.1.4 add and configure Activity 346 to the App Widget
Instance 79: You can select a digital clock 346
15.2 shortcuts 350
15.2.1 add shortcuts 350 to the shortcut list
15.2.2 directly put the shortcut to the desktop 351
15.3 LiveFolder 351
15.4 summary of this Chapter 353
Chapter 2 NDK programming 16th
16.1 introduction to Android NDK 354
16.2 install, configure, and test the NDK Development Environment 355
16.2.1 system and software requirements 355
16.2.2 download and install Android NDK 355
16.2.3 download and install Cygwin 356.
16.2.4 configure the Android NDK Development Environment 358
16.2.5 examples of compiling and running NDK 359
16.3 Android NDK development 361
16.3.1 JNI Interface Design 361
16.3.2 step 362 of compiling the Android NDK Program
Instance 80: converts lowercase letters in the file to uppercase letters (NDK version) 362
16.3.3 configure Android. mk file 364
16.3.4 variables defined by Android NDK: 365
16.3.5 functions defined by Android NDK 366
16.3.6 description module variable 366
16.3.7 configure Application. mk 367
16.4 summary of this chapter 368
Chapter 5 integrate Android and script language 17th
17.1 introduction to the Android script environment 369
17.2 Android script environment installation 370
17.3 write and run Android script 371
17.4 summary of this Chapter 373
Chapter 2 new features of the Android platform 18th
18.1 New Features of Android 374
18.1.1 New Features of Android 1.6 374
18.1.2 New Features of Android 2.0 376
18.2 Android Framework API evolution 376
18.2.1 Android 1.6 Framework API change 376
18.2.2 Android 2.x Framework API changes by 377
18.3 Live Wallpapers (Android 2.1) 377
18.4 complementary animation Renderer (Android 1.6) 384
18.4.1 Anticipate render 385
18.4.2 Overshoot render 385
18.4.3 Anticipate/Overshoot render 385
18.4.4 Bounce Renderer 385
18.5 summary of this chapter 386
Chapter 2 alternative input and output (Android 19th) 1.6
19.1 Gesture 387
19.1.1 create a gesture file 387
19.1.2 input the string 388 with a gesture
19.1.3 call the program through gestures 390
19.1.4 compile your own gesture generator 391
19.2 let the mobile phone talk (TTS) 392
19.3 Summary of this chapter 393
Chapter 2 Bluetooth (Android 20th) 2.0
20.1 Bluetooth introduction 394
20.2 enable and disable the bluetooth device 395
20.3 search for Bluetooth devices 395
20.4 Bluetooth Socket 397
20.5 OBEX server 399
20.6 summary of this Chapter 400
Chapter 4 OPhone introduction 21st
21.1 OPhone platform overview 401
21.1.1 OPhone system architecture 401
21.1.2 JIL Widget running environment 402
21.1.3 OPhone application display 402
21.2 build an OPhone Development Environment 403
21.2.1 install ODT and WDT 403
21.2.2 test whether ODT is successfully installed 403
21.2.3 test whether WDT is successfully installed 403
21.3 Summary of this chapter 404
Chapter 2 OPhone API extension 22nd
22.1 Video Phone 405
22.1.1 call video 405
22.1.2 disconnect the video phone 405
Example 81: Program 406 that can call a video call
22.2 search API 407
22.3 summary of this Chapter 408
Chapter 2 JIL Widget development details 23rd
23.1 compile the first JIL Widget program 409
23.2 multimedia 411
23.2.1 play audio 411
23.2.2 play video 412
23.3 operating file 412
23.3.1 obtain file-related information 413
23.3.2 operating file 413
23.3.3 operating folder 415
23.4 obtain system information 416
23.4.1 obtain battery information 416
23.4.2 obtain mobile phone signal information 417
23.4.3 obtain device information 418
23.4.4 obtain device status information 418
23.5 control hardware 419
23.5.1 photo taking and video recording 420
23.5.2 call 420
23.5.3 mobile phone vibration 420
23.6 summary of this chapter 421
Chapter 2 Perpetual calendar 24th
24.1 Main Interface Design and Implementation 422
24.1.1 core category of Perpetual Calendar: Calendar 422
24.1.2 base class of the calendar content element: CalendarParent 424
24.1.3 drawing Perpetual calendar Border: Border class 424
24.1.4 drawing Week name: Week class 425
24.2.5 Draw Date and Grid: Grid class 426
24.2.6 calendar view: CalendarView class 433
24.2.7 main interface for generating Perpetual calendar 435
24.2 option menu function 436
24.2.1 switch to today's date 436
24.2.2 date 436
24.3 calendar 437 which can write diaries and reminders
24.3.1 show all records: AllRecord class 437
24.3.2 add and modify records: Record class 439
24.3.3 set the reminder time to 440
24.3.4 start service 441
24.3.5 display the notification page in the broadcast receiver 442
24.3.6 access the database: DBService 443
24.4 summary of this Chapter 447
Chapter 2 Google GTalk robot 25th
25.1 GTalk communication protocols and technologies 448
25.1.1 Jabber and XMPP 448
25.1.2 XMPP client library: Smack and Asmack 449
25.2 log on to GTalk: Login class 449
25.3 contact information 451
25.3.1 display contact list 451
25.3.2 whether the listener contact is online 453
25.4 communication between contacts 454
25.4.1 send chat 455
25.4.2 receive chat information 455
25.4.3 automatically replies to the current location (GPS location) 458
25.5 summary of this chapter 459

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.