Cover Page - Tutorialspoint

Transcription

Cover page

AndroidAbout the TutorialAndroid is an open-source, Linux-based operating system for mobile devices such assmartphones and tablet computers. Android was developed by the Open Handset Alliance,led by Google, and other companies.This tutorial will teach you the basic Android programming and will also take you throughsome advance concepts related to Android application development.AudienceThis tutorial has been prepared for beginners to help them understand basic Androidprogramming. After completing this tutorial, you will find yourself at a moderate level ofexpertise in Android programming from where you can take yourself to next levels.PrerequisitesAndroid programming is based on Java programming language. If you have a basicunderstanding of Java programming, then it will be fun to learn Android applicationdevelopment.Copyright & Disclaimer Copyright 2014 by Tutorials Point (I) Pvt. Ltd.All the content and graphics published in this e-book are the property of Tutorials Point (I)Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute or republishany contents or a part of contents of this e-book in any manner without written consentof the publisher.We strive to update the contents of our website and tutorials as timely and as precisely aspossible, however, the contents may contain inaccuracies or errors. Tutorials Point (I) Pvt.Ltd. provides no guarantee regarding the accuracy, timeliness or completeness of ourwebsite or its contents including this tutorial. If you discover any errors on our website orin this tutorial, please notify us at contact@tutorialspoint.comi

AndroidTable of ContentsAbout the Tutorial . iAudience. iPrerequisites. iCopyright & Disclaimer . i1. ANDROID – OVERVIEW. 1What is Android? . 1Features of Android . 1Android Applications . 22. ANDROID – ENVIRONMENT SETUP. 3Step 1 - Setup Java Development Kit (JDK). 3Step 2 - Setup Android SDK . 4Step 3 - Setup Eclipse IDE . 5Step 4 - Setup Android Development Tools (ADT) Plugin . 6Step 5 - Create Android Virtual Device . 83. ANDROID – ARCHITECTURE . 10Linux kernel . 10Libraries . 10Android Runtime . 11Application Framework . 11Applications . 114. ANDROID – APPLICATIONS COMPONENT . 12Activities . 12Services . 12Broadcast Receivers . 13ii

AndroidContent Providers . 13Additional Components . 135. ANDROID – HELLO WORLD EXAMPLE . 15Create Android Application . 15Anatomy of Android Application . 16The Main Activity File . 18The Manifest File . 19The Strings File . 20The R File . 21The Layout File . 22Running the Application . 236. ANDROID – ORGANIZING & ACCESSING THE RESOURCES . 24Organize Resources . 24Alternative Resources . 25Accessing Resources . 27Accessing Resources in Code . 27Accessing Resources in XML . 287. ANDROID – ACTIVITIES . 308. ANDROID – SERVICES . 369. ANDROID – BROADCAST RECEIVERS. 46Creating the Broadcast Receiver . 46Registering Broadcast Receiver . 46Broadcasting Custom Intents . 4810. ANDROID – CONTENT PROVIDERS. 55Content URIs. 55iii

AndroidCreate Content Provider . 5611. ANDROID – FRAGMENTS . 70Fragment Life Cycle . 71How to use Fragments? . 7212. ANDROID – INTENTS & FILTERS . 80Intent Objects . 80Action . 81Data . 81Category . 82Extras . 82Flags . 82Component Name. 82Types of Intents . 82Explicit Intents . 82Implicit Intents . 83Intent Filters . 8813. ANDROID – UI LAYOUTS . 98Android Layout Types . 99Layout Attributes . 99View Identification . 10214. ANDROID – UI CONTROLS . 103Android UI Controls . 103Create UI Controls . 10515. ANDROID – EVENT HANDLING . 106Event Listeners & Event Handlers . 106iv

AndroidEvent Listeners Registration: . 107Event Handling Examples . 107Registration Using the Activity Implements Listener Interface . 112Registration Using Layout file activity main.xml . 115Exercise: . 11817. ANDROID – STYLES & THEMES . 119Defining Styles . 119Using Styles .

Android was developed by the Open Handset Alliance, led by Google, and other companies. Android offers a unified approach to application development for mobile devices which means