android

72
ANDROID

Upload: techknowxpress

Post on 13-May-2015

969 views

Category:

Technology


0 download

DESCRIPTION

Android Basics

TRANSCRIPT

  • 1.CONTENTS Introduction History Basic Terminologies API levels , NDK & sandbox Alpha Beta Cupcake Donut Eclair Froyo

2. CONTENTS Gingerbread Honeycomb Ice Cream Sandwich Jelly Bean KitKat Specifications Android Activity Lifecycle Android OS Architecture Android Programming Framework 3. CONTENTS Eclipse installation procedure Basic steps for creating a program Basic steps for running a program Basic programs 4. INTRODUCTION Android is an operating system based on the Linux kerneland designed primarily for touchscreen mobile devices such as smartphones and tablet computers. Google acquired Android Inc. on August 17, 2005 The first commercially available phone to run Android wasthe HTC Dream, released on October 22, 2008. 5. HISTORY Android, Inc. was founded in Palo Alto, California inOctober 2003 by Andy Rubin, Rich Miner, Nick Sears and Chris White to develop smarter mobile devices that are more aware of its owner's location and preferences Android is open source and Google releases the code underthe Apache License. 6. BASIC TERMINOLOGIES apk file:-Android application package file. .dex file :- Compiled Android application code file. Action :-A description of something that an Intent sender wants done.An action is a string value assigned to an Intent. Activity :- A single screen in an application, with supporting Javacode, derived from the Activity class. Most commonly, an activity is visibly represented by a full screen window that can receive and handle UI events and perform complex tasks, because of the Window it uses to render its window. Though an Activity is typically full screen, it can also be floating or transparent. adb :- Android Debug Bridge 7. BASIC TERMINOLOGIES(continue...) Application:-An Android application consists of one or moreactivities, services, listeners, and intent receivers. Canvas :-A drawing surface that handles compositing of the actual bitsagainst a Bitmap or Surface object. Content Provider :-A data-abstraction layer that you can use to safelyexpose your application's data to other applications. Dalvik :-The Android platform's virtual machine. The Dalvik VM is aninterpreter-only virtual machine that executes files in the Dalvik Executable (.dex) format DDMS :- Dalvik Debug Monitor Service Dialog :- A floating window that acts as a lightweight form 8. BASIC TERMINOLOGIES(continue...) Drawable :- A compiled visual resource that can be used as abackground, title, or other part of the screen Intent :-An message object that you can use to launch or communicatewith other applications/activities asynchronously. Intent Filter :- A filter object that an application declares in its manifestfile, to tell the system what types of Intents each of its components is willing to accept and with what criteria. Broadcast Receiver :- An application class that listens for Intents that arebroadcast, rather than being sent to a single target application/activity. Layout Resource :- An XML file that describes the layout of an Activityscreen. 9. BASIC TERMINOLOGIES(continue...) Manifest File :- An XML file that each application must define, to describe the application's package name, version, components (activities, intent filters, services), imported libraries and describes the various activities and so on. OpenGL ES:-Android provides OpenGL ES libraries that you can use for fast, complex 3D images. Resources :- Nonprogrammatic application components that are external to the compiled application code, but which can be loaded from application codeusing a well-known reference format. Service :-An object of class Service that runs in the background (without any UI presence) to perform various persistent actions, such as playing music or monitoring network activity. 10. BASIC TERMINOLOGIES(continue...) Surface :- A Surface holds a Canvas object for drawing, and providesvarious helper methods to draw layers and resize the surface. SurfaceView:-A View object that wraps a Surface for drawing, andexposes methods to specify its size and format dynamically. Theme:-A set of properties (text size, background color, and so on)bundled together to define various default display settings. URIs in Android:-Android uses URI strings as the basis for requestingdata in a content provider (such as to retrieve a list of contacts) and for requesting actions in an Intent (such as opening a Web page in a browser). 11. BASIC TERMINOLOGIES(continue...) View :-A View is a base class for most layout components of an Activityor Dialog screen (text boxes, windows, and so on). Viewgroup:- A container object that groups a set of child Views. Widget :-View subclasses that render form elements and other UIcomponents, such as a text box or popup menu. 12. API LEVELS API Level is an integer value that uniquely identifies theframework API revision offered by a version of the Android platform.NDK NDK stands for Native Development Kit. The NDK is a toolset that allows you to implement parts of yourapp using native-code languages such as C and C++.SANDBOX A sandbox is an isolated area of the system that does not haveaccess to the rest of the system's resources, unless access permissions are explicitly granted by the user when the application is installed. 13. ALPHA Android version-1.0 , API Level-1BETA Android version:-1.1 , API Level-2 The first two android versions were not assigned anycodename, API level or NDK. 14. CUPCAKE Android version-1.5 , API Level-3 , NDK :- 1KEY FEATURES o o o o oSmart virtual keyboard Home Screen with widgets Live folders for quick viewing of data Video recording and sharing Picasa image uploading 15. CUPCAKE(continue...) o Faster standards compliant browsers. o Voice search. o Stereo Bluetooth and hands free calls. 16. DONUT Android version-1.6 , API Level-4 , NDK:-2KEY FEATURES Quick Search Box for Android:-Android 1.6 includes aredesigned search framework that provides a quick, effective, and consistent way for users to search across multiple sourcessuch as browser bookmarks & history, contacts, and the webdirectly from the home screen. Camera, Camcorder, and Gallery:-An updated userinterface provides an integrated camera, camcorder, and gallery experience. Users can quickly toggle between still and video capture modes. Additionally, the gallery enables users to select multiple photos for deletion. 17. DONUT(continue...) Battery usage indicator:-A new battery usage screen letsusers see which apps and services are consuming battery power. If the user determines that a particular service or application is using too much power, they can take action to save the battery by adjusting settings, stopping the application, or uninstalling the application. Accessibility:-Users will be able to download newaccessibility services built on the new accessibility framework and enable them in Settings. Telephony support for CDMA:- Android 1.6 includessupport for CDMA in the telephony stack. 18. DONUT(continue...) Accessibility:- With this framework, developers cancreate accessibility plugins that respond to user input, such as making a sound when a new window is shown, vibrating when navigating to the top of a list, and providing spoken feedback. Expanded support for screen densities andresolutions:- Android 1.6 adds screen support that enables applications to be rendered properly on different display resolutions and densities. Developers can also specify the types of screens supported by their application. 19. DONUT(continue...) Gestures:-A new gestures framework providesapplication developers with a framework for creating, storing, loading and recognizing gestures and associating them with specific actions. Text-to-speech engine Expanded Search Framework. 20. ECLAIR Android version:- 2.0,2.0.1, 2.1 , API Level:- 5,6,7 , NDK:- 3KEY FEATURES o Media Framework:- Revamped graphicsarchitecture for improved performance that enables better hardware acceleration. o Bluetooth:-Bluetooth 2.1. New BT profiles: Object Push Profile (OPP) and Phone Book Access Profile (PBAP) o New Framework APIs:-Android 2.0 includes several new developer APIs. 21. ECLAIR(continue...) o Contacts and accounts:- Multiple accounts canoo o o o obe added to a device for email and contact synchronization, including Exchange accounts. Camera:- Built-in flash support , Digital zoom , Scene mode , White balance , Colour effect , Macro focus. Android Virtual Keyboard Browser Calendar Email Messaging 22. FROYO Android version:- 2.2.x , API Level:- 8 , NDK version:-4KEY FEATURES o The phone and browser apps have dedicated shortcutsthat flank the app launcher. You can access them from any of the Home screens.o Froyo has Exchange support. Auto-discovery makes iteasy to set up and sync an Exchange email account, and the Calendar app now supports Exchange as well. Plus, there are improved security features for users and admins.o Camera controls are no longer hidden under a pull-down menu. Buttons for zoom, flash, white balance, geo-tagging, focus and exposure are right onscreen 23. FROYO(continue...) o Facility to share contacts with other phones overBluetooth.o For those so addicted to apps that internal storage isntenough, Android developer APIs now allow apps to give users the choice of where to install them: phone memory or an SD card.o Another developer API makes it possible for apps toparticipate in data backup and restore so users who want to switch Android phones or restore after a hard reset can keep their data and apps.o Broken or misbehaving apps will improve faster as nowdevelopers can get app error reports from users whenever they log in to their publisher account. 24. GINGERBREAD Android version:-2.3 - 2.3.2 , API level:- 9 , NDK :-5 Android version:- 2.3.3 - 2.3.7 , API level:- 10KEY FEATURES New on-screen keyboard :- The standard keyboardhas been greatly improved in Android 2.3, with faster input and more intuitive typing. Even cut-and-paste got a makeover. Streamlined user interface :- New colour schemes and various UI changes and polish make Android more consistent and simpler to use. Application and power management :- Android 2.3 provides better insight into what is running in the background, how much memory and CPU time it is using, and even lets you kill misbehaving apps 25. GINGERBREAD(continue...) SIP Internet calling :- Voice over IP is integrated directlyinto Android 2.3. Download management :- All your downloads from your browser, email, and other apps, can be viewed and controlled from one place. Native development :- You can receive input and sensor events, produce sound, manipulate 3D graphics contexts, access assets and storage, and more all from native code . An added Native Activity class that lets you write your lifecycle callbacks in native code. JVM speed :- For Java developers, 2.3 adds a number of speedups, most notably a concurrent garbage collector. According to Google garbage collection pauses will be under 3ms, which is small enough not to be noticed in a 30fps or even 60fps game. New JIT optimizations make Dalvik code run even faster than before. 26. GINGERBREAD Faster event distribution:- In previous versions ofAndroid, just holding your finger down on the screen would cause whatever program was running to slow down, sometimes dramatically. This is all fixed in Android 2.3. Multimedia:- Rich audio effects like reverb and headphone virtualization can be applied to local tracks or globally across multiple tracks. The platform adds built-in support for VP8/WebM video, plus AAC and AMR wideband encoding. Also, there are now official APIs for accessing the front and rear cameras. There is some limited support for extra large displays. Near Field Communications (NFC):-With the right hardware and software you could use your phone as a replacement for your credit card to make point of sale purchases. Using the NFC API apps can respond to NFC tags embedded in stockers, posters and even other devices. 27. HONEYCOMB Android version:- 3.0 , API level:- 11 Android version:- 3.1 , API level:- 12 , NDK :-6 Android version:- 3.2 , API level:- 13 KEY FEATURES Flash :- Flash 10.3 takes advantage of hardware acceleration on the Xoom. Movie Store:-Honeycomb has a movie rental store that gives you access to thousands of movies. 28. HONEYCOMB(continue...) Resizable Homescreen Widgets:- If you likewidgets, but want more out of them, you can resize them to make 'em bigger. To do that, hold your finger down over the widget until a blue frame appears over it. then drag the diamonds to resize said widget as you see fit. Pointer Device Support:- For the firsttime, Android supports pointer devices, which includes mice, trackpads and trackballs. USB Host:-Android 3.1 now accepts USB devicesas a host, meaning thumbdrives, cameras, keyboards and USB peripheralslike gamepadsare accessible/functional on the Xoom. 29. HONEYCOMB(continue...) Updated Core Apps:- Browser has an updated QuickControls UI that now lets you quickly view open tabs, and access settings, supports embedded HTML5 video and enables hardware acceleration. Better Multitasking 30. ICE CREAM SANDWICH Android version:- 4.0.1 - 4.0.2 , API level:- 14 , NDK :- 7 Android version:- 4.0.3 - 4.0.4 , API level:- 15 , NDK :- 8KEY FEATURES Home screen folders and favourites tray:-New home screenfolders offer a new way for users to group their apps and shortcuts logically, just by dragging one onto another. Also, in All Apps launcher, users can now simply drag an app to get information about it or immediately uninstall it, or disable a pre-installed app. Resizable widgets:- Home screens in Android 4.0 are designedto be content-rich and customizable. Users can do much more than add shortcuts they can embed live application content directly through interactive 31. ICE CREAM SANDWICH(continue...) Widgets:- Widgets let users check email, flip through acalendar, play music, check social streams, and more right from the home screen, without having to launch apps. Widgets are resizable, so users can expand them to show more content or shrink them to save space. New lock screen actions:-The lock screens now let users domore without unlocking. From the slide lock screen, users can jump directly to the camera for a picture or pull down the notifications window to check for messages. When listening to music, users can even manage music tracks and see album art. Quick responses for incoming calls:- When an incoming call arrives, users can now quickly respond by text message, without needing to pick up the call or unlock the device. On the incoming call screen, users simply slide a control to see a list of text responses and then tap to send and end the call. Users can add their own responses and manage the list from the Settings app 32. ICE CREAM SANDWICH(continue...) Improved text input and spell-checking:-Error correction and word suggestion are improved through a new set of default dictionaries and more accurate heuristics for handling cases such as double-typed characters, skipped letters, and omitted spaces. Powerful voice input engine:- Android 4.0introduces a powerful new voice input engine that offers a continuous "open microphone" experience and streaming voice recognition. 33. JELLY BEAN Android version:- 4.1.x, API level:- 16 Android version:- 4.2.x, API level:- 17 Android version:- 4.3.x, API level:- 18 KEY FEATURES Graphics :- OpenGL ES 3.0 - Android now supports the latestversion of the industry standard for high performance graphics. Wireless Display for Nexus 7 (2013 edition) and Nexus 10 - project from your tablet to a TV. Internationalization and localization :- Additionallanguage support - Android is now translated in Africaans, Amharic , Hindi, Swahili and Zulu. Hebrew, Arabic, and other RTL (right-to-left) - now supported in the home screen, settings, and Phone, People, and Keep apps. 34. JELLY BEAN(continue...) Keyboard & input :- Easier text input - an improvedalgorithm for tap-typing recognition makes text input easier. Lower latency input for gamepad buttons and joysticks. Location :- Location detection through Wi-Fi - use Wi-Fi to detect location without turning on Wi-Fi all the time. Networking:- Bluetooth Smart support - devices likeNexus 4 and Nexus 7 are now Bluetooth Smart Ready . Bluetooth AVRCP 1.3 support - display song names on a car stereo. 35. JELLY BEAN(continue...) Settings:- Disabled apps tab - check which apps aredisabled in Settings > Apps. System :- Restricted profiles - put your tablet into amode with limited access to apps and content. Setup wizard simplification - getting started on Android is easier due to the ability to correct previous input and because of streamlined user agreements. Faster user switching - switching users from the lock screen is now faster. Enhanced photo daydream - navigate through interesting albums. 36. KITKAT Android version:- 4.4 - 4.4.2 , API Level:- 19KEY FEATURES Better Memory Management:- KitKat is designed to runon devices with as little as 512MB of RAM. Built-In Sensors:- Android 4.4 adds operating systemsupport for two new composite sensors: step counter and step detector. This support will allow fitness app developers to access pedometer data without writing complex code and algorithms. Smarter Caller ID:- identify any unknown numbers bycross-checking the number with nearby businesses. In addition to the new integration with Google Maps, the new phone app also prioritizes your contacts based on the people you talk to most. 37. KITKAT(continue...) Immersive Mode:- Android 4.4 comes with a newimmersive mode that hides everything except the app youre using. Integration With Cloud Storage:- Android 4.4 comessupport for cloud storage solutions such as Google Drive built into the operating system. This means that you can save and open directly from the cloud, without having to save into your devices storage first. Printing On The Go:- Google is making it much easier toprint documents or photos on your phone by building support for Google Cloud Print directly into Android 4.4. Lock Screen Art:- The Android 4.4 lock screen can nowshow more than just widgets 38. KITKAT(continue...) System-Wide Closed Captioning Low-power location monitoring Built-in infrared blaster support Easy home screen switching Improved Google Now Redesigned downloads app Hangouts App Upgraded 39. SPECS Company/ developer:- GoogleOpen Handset Alliance Android Open Source Project (AOSP) Programmed in:-C (core), C++, Java (UI). OS family:-Unix-like. Working state:-current. Source model:-Open source with proprietary components Initial release:-September 23, 2008. 40. SPECS(continue...) Latest stable release:- 4.4 KitKat. Available language(s):-46 Supported platforms:- 32-bit ARM, MIPS, x86. Kernel type:- Monolithic Userland:- Bionic libc, shell from NetBSD ,native coreutilities with a few from NetBSD 41. SPECS(continue...) Default user interface:- Graphical(multi-touch) License:- Apache License 2.0Linux kernel patches under GNU GPL v2 Official website:- www.android.com 42. ANDROID ACTIVITY LIFECYCLE 43. ANDROID OS ARCHITECTURE 44. ANDROID PROGRAMMING FRAMEWORK 45. ECLIPSE INSTALLATION PROCEDURE Android programs are developed in Eclipse Eclipse can be downloaded from the followingwebsite: http://www.eclipse.org/downloads/ 46. ECLIPSE INSTALLATION PROCEDURE(continue...) Click to start downloading. Depending on your browser settings, you may be asked to confirm that you want to save the file on your computer or choose where to save it. Make sure you know where the file is being downloaded. Once you have obtained the Eclipse .zip file, open it and choose Extract All to begin the extraction process. It is recommend that you move the extracted eclipse folder to C:Program Files. The extracted folder should then be C:Program Fileseclipse. 47. ECLIPSE INSTALLATION PROCEDURE(continue...) Once you have extracted and moved the eclipse folder to itsdestination, you can create a shortcut to Eclipse. There are several ways to create shortcut. In Windows XP: navigate to: C:Program Fileseclipse, right click on eclipse.exe and select Create Shortcut. You may then drag this shortcut to your Desktop or Start Menu. In Windows Vista or Windows 7: navigate to: C:ProgramFileseclipse, right click on eclipse.exe and select Pin to Start Menu. 48. ECLIPSE INSTALLATION PROCEDURE(continue...) Each time you run Eclipse, you will be prompted to select aworkspace, which is where the programs you write are stored. Click Use this as the default and do not ask again to avoid having to type in the workspace path every time you start. If you are shown a Welcome to Eclipse screen, click the Workbench button to reach the main Eclipse environment, where you will develop your programs. 49. ECLIPSE INSTALLATION PROCEDURE(continue...) Setting the compiler compliance Choose Window -> Preferences from the Eclipse toolbar. - In thePreferences window, expand the Java option in the navigation tree and click the Compiler option. - In the Compiler panel, set the Compiler compliance level to 1.6. - Click OK to save your changes. 50. ECLIPSE INSTALLATION PROCEDURE(continue...) Setting the folders Choose Window -> Preferences from the Eclipse toolbar. - In thePreferences window, in the navigation tree, expand the Java option and click the Build Path option. - In the Build Path panel, select the Project radio button. - Click OK to save your changes. 51. ECLIPSE INSTALLATION PROCEDURE(continue...) Connecting the Java documentation to Eclipse Choose Window -> Preferences from the Eclipse toolbar. - In thePreferences window, in the navigation tree, expand the Java option and click the Installed JREs option. - In the Installed JREs panel, make sure the most current version of Java is checked .Select it and click Edit. 52. ECLIPSE INSTALLATION PROCEDURE(continue...) An Edit JRE window will open. This window shows a list of "JREsystem libraries", and you need to link each library to the Java documentation. STEPS Select a system library. Click the Javadoc Location button, which opens a Javadoc.In the new window: - Select Javadoc in archive and External file. Set the Archive Path to the .zip file containing the java documentation, which you downloaded when installing Java. This path should be: C:Program FilesJavajdk1.7.0_02jdk-7u2apidocs.zip In the Path within archive field, enter docs/api. Click OK to get back to the Edit JRE window and start again with the next library in the list When done with all the libraries, click Finish and then OK. 53. ECLIPSE INSTALLATION PROCEDURE(continue...) 54. ECLIPSE INSTALLATION PROCEDURE(continue...) Following the above steps will install eclipse successfully and you cannow develop your projects 55. BASIC STEPS FOR CREATING AN APPLICATION Go to File -> new -> android application project. Design your graphical layout in activity_main.xml Res->layout -> activity_main.xml Add String variables in string.xml Res-> values ->strings.xml Declare variables for textview, button, checkbox, etc inMainActivity.xml Src -> com.exampleapp_name -> MainActivity.xml 56. BASIC STEPS FOR RUNNING AN APPLICATION Create an AVD using the Android Virtual Device Manager AVD manager-> New -> Give name ->Device Type ->Target API ->size -> ok Right click on app_name select Run As -> AndroidApplication 57. PROGRAM TO PRINT HELLO WORLD Create a text viewAssign the text in the text view a name in Strings.xml 58. PROGRAM TO PRINT HELLO WORLD(continue...) Now run the application in the AVD and you will see the String Hello World printed on the screen. 59. PROGRAM TO ACCEPT INPUT FROM USER Create a TextView and an EditText in activity_main.xml 60. PROGRAM TO ACCEPT INPUT FROM USER(continue...) After writing the code in activity_main.xml , you cancheck out the layout in the Graphical Layout window. In this case it will appear like this: 61. PROGRAM TO ACCEPT INPUT FROM USER(continue...) Assign the text in the text view a name in Strings.xml 62. PROGRAM TO ACCEPT INPUT FROM USER(continue...) Create a variable of type EditText in MainActivity.java 63. PROGRAM TO ACCEPT INPUT FROM USER(continue...) Now run the application in the AVD and you will seethe String user and a text area printed on the screen. 64. PROGRAM TO ADD TWO NUMBERS Create a textview for first number and accept its valuefrom user. 65. PROGRAM TO ADD TWO NUMBERS(continue...) Create a textview for second number and accept its value from user. 66. PROGRAM TO ADD TWO NUMBERS(continue...) Create a button on whose on click event the sum willbe displayed. 67. PROGRAM TO ADD TWO NUMBERS(continue...) strings.xml 68. PROGRAM TO ADD TWO NUMBERS(continue...) MainActivity.java 69. PROGRAM TO OBTAIN POSITION OF SELECTED ITEM IN LISTVIEW Note: Never use listview inside RelativeLayout . Activity_main.xml 70. PROGRAM TO OBTAIN POSITION OF SELECTED ITEM IN LISTVIEW(continue...) MainActivity.java