شروع دوره های تخصصی, پایتون | هوش مصنوعی 18 دی شروع دوره های تخصصی, پایتون | هوش مصنوعی 18 دی
ثبت نام
Donn Felker

Android.Application.Development.for.For.Dummies

نویسنده :Donn Felker

     

    Introduction ................................................................. 1
    About This Book ..............................................................................................1
    Conventions Used in This Book .....................................................................2
    Foolish Assumptions .......................................................................................3
    How This Book Is Organized ..........................................................................3
    Part I: The Nuts and Bolts of Android .................................................3
    Part II: Building and Publishing Your First Android Application .....4
    Part III: Creating a Feature-Rich Application ......................................4
    Part IV: The Part of Tens .......................................................................4
    Icons Used in This Book .................................................................................4
    Where to Go from Here ...................................................................................5
    Part I: The Nuts and Bolts of Android ............................ 7
    Chapter 1: Developing Spectacular Android Applications . . . . . . . . . .9
    Why Develop for Android? .............................................................................9
    Market share .........................................................................................10
    Time to market .....................................................................................10
    Open platform ......................................................................................10
    Cross-compatibility .............................................................................11
    Mashup capability ...............................................................................11
    Android Programming Basics ......................................................................13
    Java: Your Android programming language .....................................13
    Activities ...............................................................................................14
    Intents....................................................................................................14
    Cursorless controls .............................................................................15
    Views and widgets ...............................................................................16
    Asynchronous calls .............................................................................16
    Background services ...........................................................................17
    Hardware Tools .............................................................................................18
    Touchscreen .........................................................................................19
    GPS .........................................................................................................19
    Accelerometer ......................................................................................20
    SD Card ..................................................................................................20
    Software Tools ...............................................................................................20
    Internet ..................................................................................................21
    Audio and video support ....................................................................21
    Contacts ................................................................................................21
    Security .................................................................................................22
    Introduction ................................................................. 1
    About This Book ..............................................................................................1
    Conventions Used in This Book .....................................................................2
    Foolish Assumptions .......................................................................................3
    How This Book Is Organized ..........................................................................3
    Part I: The Nuts and Bolts of Android .................................................3
    Part II: Building and Publishing Your First Android Application .....4
    Part III: Creating a Feature-Rich Application ......................................4
    Part IV: The Part of Tens .......................................................................4
    Icons Used in This Book .................................................................................4
    Where to Go from Here ...................................................................................5
    Part I: The Nuts and Bolts of Android ............................ 7
    Chapter 1: Developing Spectacular Android Applications . . . . . . . . . .9
    Why Develop for Android? .............................................................................9
    Market share .........................................................................................10
    Time to market .....................................................................................10
    Open platform ......................................................................................10
    Cross-compatibility .............................................................................11
    Mashup capability ...............................................................................11
    Android Programming Basics ......................................................................13
    Java: Your Android programming language .....................................13
    Activities ...............................................................................................14
    Intents....................................................................................................14
    Cursorless controls .............................................................................15
    Views and widgets ...............................................................................16
    Asynchronous calls .............................................................................16
    Background services ...........................................................................17
    Hardware Tools .............................................................................................18
    Touchscreen .........................................................................................19
    GPS .........................................................................................................19
    Accelerometer ......................................................................................20
    SD Card ..................................................................................................20
    Software Tools ...............................................................................................20
    Internet ..................................................................................................21
    Audio and video support ....................................................................21
    Contacts ................................................................................................21
    Security .................................................................................................22
    Google APIs ...........................................................................................22
    Chapter 2: Prepping Your Development Headquarters . . . . . . . . . . . . .25
    Developing the Android Developer Inside You .........................................25
    Assembling Your Toolkit ..............................................................................26
    Android source code ...........................................................................26
    Linux 2.6 kernel ....................................................................................27
    Android framework..............................................................................27
    Application framework ........................................................................28
    Open Handset Alliance libraries ........................................................30
    Java knowledge ....................................................................................31
    Tuning Up Your Hardware ...........................................................................31
    Operating system .................................................................................31
    Computer hardware ............................................................................32
    Installing and Confi guring Your Support Tools .........................................32
    Getting the Java Development Kit ...............................................................33
    Downloading the JDK ..........................................................................33
    Installing the JDK .................................................................................35
    Acquiring the Android SDK ..........................................................................35
    Downloading the Android SDK ...........................................................35
    Following and setting your tools path ..............................................38
    Getting the Total Eclipse ..............................................................................41
    Choosing the right Eclipse version ....................................................41
    Installing Eclipse ..................................................................................41
    Confi guring Eclipse ..............................................................................43
    Getting Acquainted with the Android Development Tools ......................47
    Navigating the Android SDK ...............................................................47
    Targeting Android platforms ..............................................................48
    Using SDK tools for everyday development .....................................49
    Part II: Building and Publishing
    Your First Android Application .................................... 53
    Chapter 3: Your First Android Project. . . . . . . . . . . . . . . . . . . . . . . . . . . .55
    Starting a New Project in Eclipse .................................................................55
    Deconstructing Your Project .......................................................................61
    Responding to error messages ..........................................................62
    Understanding the Build Target and Min SDK Version settings ....63
    Setting Up an Emulator .................................................................................65
    Creating Launch Confi gurations ..................................................................68
    Creating a debug confi guration ..........................................................68
    Creating a run confi guration ..............................................................68
    Duplicating your launch confi guration for quick setup ..................71
    Running the Hello Android App ...................................................................72
    Running the app in the emulator .......................................................72
    Checking deployment status ..............................................................77
    Understanding Project Structure ................................................................78
    Navigating the app’s folders ...............................................................78
    Viewing the application’s manifest fi le .............................................88
    Viewing the default.properties fi le ....................................................90
    Chapter 4: Designing the User Interface . . . . . . . . . . . . . . . . . . . . . . . . .93
    Creating the Silent Mode Toggle Application ............................................94
    Laying Out the Application ..........................................................................95
    Using the XML layout fi le ....................................................................96
    Using the Android SDK’s layout tools ...............................................98
    Using the visual designer ....................................................................99
    Developing the User Interface ....................................................................102
    Viewing XML layout attributes .........................................................102
    Working with views ...........................................................................103
    Adding an Image to Your Application .......................................................104
    Placing an image on the screen........................................................105
    Adding the image to the layout ........................................................106
    Creating a Launcher Icon for the Application ..........................................108
    Designing a custom launcher icon ...................................................109
    Adding a custom launcher icon .......................................................110
    Adding a Toggle Button Widget .................................................................111
    Previewing the Application in the Visual Designer .................................113
    Changing the orientation ..................................................................114
    Changing the background color .......................................................114
    Chapter 5: Coding Your Application . . . . . . . . . . . . . . . . . . . . . . . . . . . .117
    Understanding Activities ............................................................................117
    Working with methods, stacks, and states .....................................118
    Tracking an activity’s life cycle ........................................................119
    Creating Your First Activity .......................................................................122
    Starting with onCreate ......................................................................122
    Handling the bundle ..........................................................................123
    Telling Android to display the UI .....................................................123
    Handling user input ...........................................................................124
    Writing your fi rst event handler ......................................................125
    Working with the Android Framework Classes .......................................128
    Getting good service ..........................................................................128
    Toggling silent mode with AudioManager ......................................129
    Installing Your Application .........................................................................133
    Returning to the emulator ................................................................133
    Installing on a physical Android device ..........................................135
    Reinstalling Your Application ....................................................................137
    Understanding the state of the emulator ........................................137
    Doing the reinstallation .....................................................................137
    Uh-oh!: Responding to Errors .....................................................................138
    Using the Dalvik Debug Monitor Server ..........................................138
    Using the Eclipse debugger ..............................................................143
    Thinking Beyond Your Application Boundaries ......................................151
    Interacting with your application ....................................................151
    Does it work?: Testing your application .........................................152
    Chapter 6: Understanding Android Resources . . . . . . . . . . . . . . . . . . .155
    Understanding Resources ..........................................................................155
    Dimensions .........................................................................................156
    Styles ...................................................................................................156
    Themes ................................................................................................157
    Values ..................................................................................................157
    Menus ..................................................................................................157
    Colors ..................................................................................................158
    Working with Resources .............................................................................158
    Moving strings into resources .........................................................158
    Wrestling the image beast ................................................................160
    Making your apps global with resources ........................................161
    Chapter 7: Turning Your Application into a Home-Screen Widget. . . .163
    Working with App Widgets in Android .....................................................164
    Working with remote views ..............................................................165
    Using AppWidgetProviders ..............................................................166
    Working with Pending Intents ....................................................................167
    Understanding the Android intent system .....................................167
    Understanding intent data ................................................................168
    Evaluating intents ..............................................................................170
    Using pending intents ........................................................................170
    Creating the Home-Screen Widget .............................................................172
    Implementing the AppWidgetProvider ...........................................172
    Communicating with the app widget ..............................................173
    Building the app widget’s layout .....................................................175
    Doing work inside an AppWidgetProvider .....................................176
    Working with the app widget’s metadata .......................................181
    Registering your new components with the manifest...................182
    Placing Your Widget on the Home Screen ................................................184
    Chapter 8: Publishing Your App to the Android Market . . . . . . . . . . .187
    Creating a Distributable File .......................................................................187
    Revisiting the manifest fi le................................................................188
    Choosing your tools ..........................................................................189
    Digitally signing your application ....................................................189
    Creating the APK fi le ..........................................................................191
    Creating an Android Market Account .......................................................194
    Pricing Your Application ............................................................................200
    Why to choose the paid model ........................................................200
    Why to choose the free model .........................................................201
    Getting Screen Shots for Your Application ..............................................201
    Uploading Your Application to the Android Market ...............................203
    Watching the Installs Soar ..........................................................................207
    Chapter 9: Designing the Task Reminder Application . . . . . . . . . . . .211
    Reviewing the Basic Requirements ...........................................................211
    That’s alarming!: Scheduling a reminder script .............................212
    Storing data ........................................................................................212
    Distracting the user (nicely).............................................................213
    Creating the Application’s Screens ...........................................................213
    Starting the new project....................................................................214
    Creating the task list ..........................................................................214
    Creating and editing task activities .................................................216
    Creating the adding/editing layout ..................................................217
    Creating Your First List Activity ................................................................220
    Getting stubby with fake data ..........................................................221
    Handling user click events ................................................................222
    Identifying Your Intent ................................................................................224
    Starting new activities with intents .................................................224
    Retrieving values from previous activities .....................................225
    Creating a chooser .............................................................................226
    Chapter 10: Going a la Carte with Your Menu. . . . . . . . . . . . . . . . . . . .231
    Seeing What Makes a Menu Great .............................................................232
    Creating Your First Menu ...........................................................................232
    Defi ning the XML fi le..........................................................................232
    Handling user actions ........................................................................234
    Creating a reminder task...................................................................235
    Completing the activity .....................................................................235
    Creating a Context Menu ............................................................................236
    Creating the menu XML fi le ..............................................................237
    Loading the menu ..............................................................................237
    Handling user selections ...................................................................238
    Chapter 11: Handling User Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .241
    Creating the User Input Interface ..............................................................241
    Creating an EditText widget .............................................................241
    Displaying an on-screen keyboard ..................................................243
    Getting Choosy with Dates and Times ......................................................244
    Creating picker buttons ....................................................................244
    Wiring up the date picker .................................................................245
    Wiring up the time picker .................................................................250
    Creating Your First Alert Dialog Box .........................................................252
    Seeing why you should work with dialog boxes ............................253
    Choosing the right dialog box for a task .........................................254
    Creating your own alert dialog box .................................................255
    Validating Input ...........................................................................................257
    Toasting the user ...............................................................................258
    Using other validation techniques...................................................258
    Chapter 12: Getting Persistent with Data Storage . . . . . . . . . . . . . . . .261
    Finding Places to Put Data ..........................................................................261
    Viewing your storage options ..........................................................262
    Choosing a storage option ................................................................263
    Asking the User for Permission .................................................................264
    Seeing how permissions affect the user experience .....................264
    Setting requested permissions in the AndroidManifest.xml fi le .....264
    Creating Your Application’s SQLite Database .........................................266
    Understanding how the SQLite database will work ......................266
    Creating a Java fi le to hold the database code ..............................267
    Defi ning the key elements .................................................................267
    Visualizing the SQL table ..................................................................269
    Creating the database table ..............................................................270
    Closing the database .........................................................................271
    Creating and Editing Tasks with SQLite ...................................................272
    Inserting your fi rst task entry...........................................................272
    Returning all the tasks with a cursor ..............................................281
    Understanding the SimpleCursorAdapter ......................................283
    Deleting a task ....................................................................................284
    Updating a task...................................................................................284
    Chapter 13: Reminding the User with AlarmManager. . . . . . . . . . . . .291
    Seeing Why You Need AlarmManager ......................................................291
    Waking Up a Process with AlarmManager ...............................................292
    Creating the ReminderManager class .............................................293
    Creating the OnAlarmReceiver class ...............................................295
    Creating the WakeReminder-IntentService class ...........................296
    Creating the ReminderService class ................................................298
    Rebooting Devices .......................................................................................299
    Creating a boot receiver ...................................................................300
    Checking the boot receiver ..............................................................302
    Chapter 14: Updating the Android Status Bar . . . . . . . . . . . . . . . . . . . .303
    Deconstructing the Status Bar ...................................................................303
    Viewing status bar icons ...................................................................303
    Using status-bar tools to notify the user ........................................304
    Using the Notifi cation Manager .................................................................307
    Creating your fi rst notifi cation .........................................................307
    Viewing the workfl ow ........................................................................309
    Adding string resources ....................................................................310
    Updating a Notifi cation ...............................................................................310
    Clearing a Notifi cation ................................................................................311
    Chapter 15: Working with Android’s Preference Framework . . . . . .313
    Understanding Android’s Preference Framework ...................................314
    Understanding the PreferenceActivity Class ...........................................314
    Persisting preference values ............................................................315
    Laying out preferences......................................................................316
    Creating Your First Preference Screen .....................................................317
    Building the preferences fi le.............................................................317
    Adding string resources ....................................................................319
    Working with the PreferenceActivity Class ..............................................320
    Opening the PreferenceActivity class .............................................321
    Handling menu selections .................................................................322
    Working with Preferences in Your Activities at Run Time .....................323
    Retrieving preference values ............................................................323
    Setting preference values .................................................................326
    Part IV: The Part of Tens ........................................... 329
    Chapter 16: Ten Great Free Sample
    Applications and SDKs (With Code!) . . . . . . . . . . . . . . . . . . . . . . . . . . .331
    The Offi cial Foursquare App ......................................................................332
    LOLCat ..........................................................................................................332
    Amazed .........................................................................................................333
    APIDemos .....................................................................................................333
    MultipleResolutions Example ....................................................................333
    Last.fm App Suite .........................................................................................334
    Hubroid .........................................................................................................334
    Facebook SDK for Android .........................................................................334
    Replica Island ...............................................................................................335
    Notepad Tutorial .........................................................................................335
    Chapter 17: Ten Tools That Make Your Developing Life Easier . . . .337
    droid-fu .........................................................................................................337
    RoboGuice ....................................................................................................338
    DroidDraw ....................................................................................................338
    Draw 9-patch ................................................................................................338
    Hierarchy Viewer .........................................................................................338
    UI/Application Exerciser Monkey ..............................................................339
    zipalign ..........................................................................................................339
    layoutopt ......................................................................................................339
    Git ..................................................................................................................339
    Paint.NET and GIMP ....................................................................................340
1394/07/27 1217 433
رمز عبور : tahlildadeh.com یا www.tahlildadeh.com
کتاب های مرتبط
آموزش کار با رشته ها در سی شارپ

Android 3.0 Animations

نویسنده: Alex Shaw

زبان: انگلیسی

مشاهده کتاب و دانلود
آموزش کار با رشته ها در سی شارپ

Android Cookbook

نویسنده: Ian F. Darwin

زبان: انگلیسی

مشاهده کتاب و دانلود
آموزش کار با رشته ها در سی شارپ

Pro Android Python with SL4A

نویسنده: Paul Ferrill

زبان: انگلیسی

مشاهده کتاب و دانلود
نظرات شما

نظرات خود را ثبت کنید...