Introduction to android basicsPresentation Transcript
Introduction to Android basics
What is Android• Android is a software platform which includes anoperating system, middleware and keyapplications.• The operating system is based on Linux and it isdeveloped by Google (Open Handset Alliance).• The developers write managed code in a Java-likelanguage that utilizes Google-developed Javalibraries but it does not support programs innative code.
Application Layer• Highest Layer in the Architecture• Built-in standard applications• -Phone Dialer• -Email• -Contacts• -Web Browser• -Android Market
Framework Layer• The most important part of the framework are asfollows:• Activity Manager• Resource Manager• Location Manager• Notification Manager
Difference Between Java and C#Architecture for Android
Android Software Development1. REQUIREMENTS:• Knowledge of programming in Java• Knowledge of XML• Android SDK• Eclipse IDE with Android Development Tools (ADT)plug-in.• Android powered smartphone (for testing purposes)
Tools required for developing androidapp: aapt - Android Asset Packaging Tool Creates .apk-files which contain all the resources as well as the programitself. Those ZIP-format based files can be transferred to and installed on anAndroid phone or the emulator. adb – Android Debug Bridge The main purpose of this tool is to set up connections to a real Androiddevice or an Android emulator instance in order to transfer and install(apk)-files on it. With adb the developer also has the possibility to remotecontrol the devices shell. dx – Dalvik The dx is used for merging and converting Java-Standard-ByteCode Classes(*.class) into one single binary file (.dex) that can be executed by the DalvikVM. These .dex-files are subject to be put into an .apk-file together withresource files.
Activities• An activity presents a visual user interface forone focused endeavor the user can undertake.• The visual content of the window is providedby a hierarchy of views.– objects derived from the base View class.• A view hierarchy is placed within an activityswindow by the Activity.setContentView()method.
Services• A Service does not have a visual interface andruns in the background.• Each service extends the Service base class.• Its possible to connect to an ongoing serviceand communicate it through the interfaceexposed by that service.
BroadcastReceiver• A broadcast receiver receive and react tobroadcast announcements.• All receivers extend the BroadcastReceiverbase class.• Many broadcasts originate in system code.• Broadcast receivers do not display a userinterface but they can start an activity or alertuser.
ContentPorvider• A content provider makes a specific set of theapplications data available to otherapplications.• All content providers extends theContentProvider base class.• Content Providers are accessed throughContentResolver object.• Content Providers and Content Resolversenable inter-process communication (IPC)
Intent• Intents are Asynchronous messages used to convey a request ormessage.• An intent is an object of Intent class that holds the content of themessage.• Activities, Services and Broadcast Receivers are activated throughIntents.• Intent can contain• Component name• Action• Data• Category• Extras• Flags
Activity Lifecycle• An activity has essentially three states• Active or Running• Paused• Stopped• Activity Lifetime• Entire Lifetime [onCreate() to onDestroy()]• Visible Lifetime [onStart() to onStop()]• Foreground Lifetime [onResume() to onPause()]• An implementation of any activity lifecycle methodshould always first call the superclass version
• onCreate(Bundle): This is called when the 1st Activity Startsup• onStart(): This indicates the activity is about to display to the user• onResume(): This is called when the activity can start interactingwith the user• onPause(): This runs when and activity about to go to thebackground• onStop(): This is called when the activity is no longer visible to theuser• onDestroy(): This is call right before your activity is destroyed, ifmemory is tight onDestroy may never be called (The system willmay terminate you process)