1 / 43

Introduction to Android application development

Introduction to Android application development. Narender Ramireddy Technical Lead IBM Chiphopper – Partner Program. Agenda. Android Framework Topics Example – Multiple Activities Data Storage Example – Shared Preferences Example – SQLite Database Location Manager

jena-benton
Download Presentation

Introduction to Android application development

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to Android application development

  2. Narender Ramireddy Technical Lead IBM Chiphopper – Partner Program

  3. Agenda Android Framework Topics Example – Multiple Activities Data Storage Example – Shared Preferences Example – SQLite Database Location Manager Example – Location Manager Notepad Example API Demos Android Overview Android SDK Example - Hello World XML UI Layout Manifest, Resources and R.java Developing on a device IBM and Android Hear from you Android User Groups in Dallas Area

  4. Pre Requisites Java or any other Object Oriented programming language background. Eclipse or similar IDE experience

  5. Android Overview Android is a software stack for mobile devices that includes an operating system, middleware and key applications. The Android SDK provides the tools and APIs necessary to begin developing applications on the Android platform using the Java programming language.

  6. Android Overview Android is a software stack for mobile devices that includes an operating system, middleware and key applications. API 2 API 3 API 4 API 5 API 6 API 7 API 8 API 9 Android 1.1 Android 1.5 Android 1.6 Android 2.0 Android 2.0.1 Android 2.1 Android 2.2 Android 2.3

  7. Phone Hardware Vendors Android x.y Stack Source Code http://source.android.com Android Mobile Device

  8. Current Distribution

  9. Historical Distribution

  10. Installing Android SDK http://developer.android.com Prepare your development computer and ensure it meets the system requirements. Install the SDK starter package. Add Android platforms and other components to your SDK. Install the ADT Plug-in for Eclipse (if you'll be developing in Eclipse).

  11. Android SDK Machine code for ARM QEMU open source machine emulator Virtual ARM Mobile Device Machine code for Target development Platform QEMU open source machine emulator Virtual ARM Mobile Device API tools SDK Starter Kit Emulator

  12. Android SDK Android 1.5 Stack Source Code Android 1.6 Stack Source Code Android 2.3 Stack Source Code Android 1.5 Android 1.6 Android 2.3 Android platforms QEMU open source machine emulator Virtual ARM Mobile Device API tools SDK Starter Kit Emulator

  13. Android SDK and AVD Manager

  14. Android Virtual Device ( AVD ) AVD AVD Android 2.3 - API 9 Android 2.2 - API 8 QEMU open source machine emulator QEMU open source machine emulator Virtual ARM Mobile Device Virtual ARM Mobile Device

  15. Creating Android Virtual Devices From Eclipse : Windows  Android SDK and AVD Manager Command Line: C:\Program Files\Android\android-sdk-windows\tools>android.bat

  16. Android Dev Guide http://developer.android.com • Android Basics • Framework Topics • Developing • Publishing • Best Practices • Tutorials and Samples • Appendix

  17. New Android Project

  18. Deploy / Run Source Source Source Compile / Build Android Virtual Device (AVD) .apk Deploy / Run Deploy / Run Device

  19. Example – Hello World

  20. XML GUI - Example • <LinearLayoutxmlns:android=http://schemas.android.com/apk/res/android • android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> • <LinearLayoutandroid:orientation="horizontal" • android:layout_width="match_parent" android:layout_height="wrap_content"> • <TextViewandroid:layout_width="wrap_content" android:layout_height="wrap_content" • android:text="@string/title" /> • <EditTextandroid:id="@+id/title" • android:layout_width="wrap_content" • android:layout_height="wrap_content" • android:layout_weight="1" /> • </LinearLayout> • <TextViewandroid:layout_width="wrap_content" • android:layout_height="wrap_content" • android:text="@string/body" /> • <EditTextandroid:id="@+id/body" • android:layout_width="match_parent" • android:layout_height="wrap_content" • android:layout_weight="1" • android:scrollbars="vertical" /> • <Button android:id="@+id/confirm" • android:text="@string/confirm" • android:layout_width="wrap_content" • android:layout_height="wrap_content" /> • </LinearLayout>

  21. List of Files for an Android Application

  22. Resources and the R class The folders under res/ in the Eclipse project are for resources. There is a specific structure to the folders and files under res/. A project's R.java file is an index into all the resources defined in the file. Resources defined in these folders and files will have corresponding entries in the R class allowing them to be easily accessed and used from your application. The R class is automatically generated using the contents of the res/ folder by the eclipse plugin (or by aapt if you use the command line tools). Furthermore, they will be bundled and deployed for you as part of the application.

  23. Developing on a Device • Declare your application as "debuggable" in your Android Manifest. • In the AndroidManifest.xml file, add android:debuggable="true" to the <application> element. • Turn on "USB Debugging" on your device. • On the device, go to the home screen, press MENU, select Applications > Development, then enable USB debugging. • You need to install a USB driver for adb • You should see the device in the list by issuing the following command • adb devices For more information go to http://developer.android.com/guide/developing/device.html

  24. process process Unique user ID Unique user ID AVD Android 2.2 - API 8 Hello World App Second App QEMU open source machine emulator Virtual ARM Mobile Device JVM JVM

  25. Android - Framework Topics

  26. Application Fundamentals • Application Components • Activating Components • The manifest file • Components Lifecycle • Activities and Tasks • Processes and Threads

  27. Application Components Activity Service Receiver Provider All components run in the main thread of the application process

  28. Activity Component Activity • Implemented as a subclass of the Activity base class • Presents a visual user interface for one focused endeavor the user can undertake • Each activity is independent of the others • An application might consist of just one activity or may contain several • Moving from one activity to another is accomplished by having the current activity start the next one • Each activity is given a default window to draw in • The visual content of the window is provided by a hierarchy of views — objects derived from the base View class. Each view controls a particular rectangular space within the window. Parent views contain and organize the layout of their children. Leaf views draw in the rectangles they control and respond to user actions directed at that space

  29. Service Component Service • Each service extends the Service base class. • A service doesn't have a visual user interface, but rather runs in the background for an indefinite period of time. • It's possible to connect to (bind to) an ongoing service (and start the service if it's not already running). While connected, you can communicate with the service through an interface that the service exposes.

  30. Receiver Component Receiver • All receivers extend the BroadcastReceiver base class. • Component that does nothing but receive and react to broadcast announcements. • An application can have any number of broadcast receivers to respond to any announcements it considers important. • They may start an activity in response to the information they receive, or they may use the NotificationManager to alert the user.

  31. Provider Component Provider • The content provider extends the ContentProvider base class to implement a standard set of methods that enable other applications to retrieve and store data of the type it controls • A content provider makes a specific set of the application's data available to other applications • Applications do not call the ContentProvider methods directly. Rather they use a ContentResolver object and call its methods instead. A ContentResolver can talk to any content provider; it cooperates with the provider to manage any interprocess communication that's involved.

  32. intents : To Activate components • An intent is an Intent object that holds the content of the message • Activities, Services, and Broadcast receivers — are activated by asynchronous messages called intents. • Content providers are activated when they're targeted by a request from a ContentResolver.

  33. Example – Multiple Activities

  34. The behavior just described is the default behavior for activities and tasks. But there are ways to modify almost all aspects of it. The association of activities with tasks, and the behavior of an activity within a task, is controlled by the interaction between flags set in the Intent object that started the activity and attributes set in the activity's <activity> element in the manifest. Both requester and respondent have a say in what happens.

  35. All components are instantiated in the main thread of the specified process, and system calls to the component are dispatched from that thread

  36. Android – Data Storage

  37. Data storage options

  38. Location Manager

  39. Data Backup

  40. Web Apps

  41. Security & Permissions

More Related