29 Nov 2012


Intent Resolution in Android API

Intent can be classified into two types Explicit and Implicit type based on the target components.
  • Explicit Type- These type of intents designates target components by their name.But generally components  name of other application is unknown to the developers. 
  • Implicit Type- In these type of intents there is no target name but is often used for activating components of other application.Intent filters are used for activating components .
    • firstly filter advertises the capabilities of a components for receiving implicit  intent of advertise type.
    • A components with filter can receive both implicit and explicit intents.
    • Three aspects are consulted when objects are tested against the intent filters .
      • action
      • data
      • category

28 Nov 2012


Intent Object in an Android.

It is a bundle of information contains information for components that receives the intent like action to be taken,data to be act upon, category of information that should handle the intent,and instruction to launch the target activity.And has following thing:
  • Component name- Describe the name of components that handle the intent although it is optional.The field is ComponentName object,a combination of fully qualified class name with target components and a package name set in the manifest file. of application where components reside.The components are set bysetComponent(),setClass(),setClassName(), and read by getComponent(). if component name is set the intent is delivered to an components otherwise i uses intent resolution.
  • Action-a string tells the action to be performed or action to be reported.  example,  ACTION_CALL which has a target components Activity has action " initaite the phone call".The action determine how the rest of intent is structured that is data andextra field.It is set by set by setAction(), and read by getAction().
  • Data-it contain two thing URI and MIME.  URI indicates where data is located on the device and MIME tells the type of data.setData(),setType().setDataType() are used for setting data and type where as getData() and getType() are used for getting data and Type.
  • Category-string contain extra information about the components that handle the intent. Eg,  CATEGORY_HOME activity displays the home screen.getCategories()is used for getting the category information.
  • Extras-provides the extra information that should given the components which handles the intent.

Intent in Android activates the components.

  • Intent activates the three major components Activity,Services,Broadcast receivers through a Message.
  • The separate mechanism of intent object exist for each components.
  • For Activity-  intent object is passed to Context.startActivity() orActivity.startActivityForResult() to launch an activity. Also intent object can also passed toActivity.setResult() to return information to the  activity that calledActivity.startActivityForResult().
  • For Services- intent objects passes to Context.startServices() to start a services. also intent objects are passed to Context.bindServices()  which establish connection between calling components and target services.
  • For broadcast- intent objects are passes to Context.sendbroadcast(),Context.sendOrederedBroadcast() or Context.sendStickyBroadcast() which deleivers to all interested broadcast receivers. 
  • Intent objects are delivered to appropriate components without any ambiguity.

27 Nov 2012


How to create Activity in an application.

To create an activity following things should be considered.
  • We need to create a subclass of Activity .
  • In our subclass ,we need to implement various call back method to manage the various state of lifecycle such as for stopped,resumed,created,destroyed.
  • Two important call back methods are oncreate() and onpause()
  • oncreate()- the system call this method when you create your activity.you needs to call thesetcontentview() to define the  layout of user interface.

26 Nov 2012


Activity an application components of Android.

Activity is an application components of android programming .It provides the user interface.
Some main points:
  • Activity is an application components of android programming .
  • Among all those activity ,one activity must be the main activity which is presented  to the user when application is installed for the first time. although every activity can interact with other activity.
  • System uses stack to manage the activity .each time a new activity starts prevoius one is stopped and preserve in the stack.
  • Activity life cycle call back method is used to notify the change of state to activity when it is stopped.this helps the activity to perform specific work which is appropriate to that state change.

24 Nov 2012


Declaration in Manifest file ie. AndroidManifest.xml

Androidmanifest.xml is the only file which tell the system about the components existing the application.Main features of manifest file:
Androidmanifest.xml

  • gives the details of user permission which application require.
  • gives the details of minimum level of API requires by application.
  • gives the details of hardware or software feature which an app require.
  • also link the API libraries against the application.
Declaring components of Manifest file.
  • In <application> ,android:icon attribute point to the resources for an application.  android:namepoints to the fully qualified class name for an application. android:label attributes points to the string which species the user visible string for application.
  • All application components are declared in this way eg, <activity> ,<services>< receiver > ,<provider> .
  • In activating components we need to use intent to start activities,services, broadcast receivers. they are declared for components using <intent-filter>.
  • <support-screen> is used to categorize screen based on the screen density and screen size.
  • <user-configuration> provides different types of input configuration such as hardware keyboard,trackball.
  • <user-feature> declares the hardware or software features which an application needs.
  • <user-sdk> declares  the min and max level of API that an application uses.

13 Nov 2012


Linux kernel a foundation for android


  • Linux kernel gives a hardware abstraction for android which provides portability to a wide variety of  platform in future.
  • It provides memory managent ,process management, power managent and many other services to android.
  • For user, Linux is always remains  hidden as it works in back end.
  • Some utilities interact with Linux  in development  like "adb shell' commands which open Linux shell which allows you to enter commands to run on the device.
  • Linux kernel has display driver, blue tooth driver, camera driver, flash memory driver,keypad driver , usb driver and many more thing.

12 Nov 2012


Application components of Android

Application components are the main building blocks of Android application in fact they are different entry points through which system enters in your application.Main components are:
  • Activities- represent user interface of an application, every interface has different activity.Activity is implemented as a subclass of Activity.
  • Services- it does not provide user interface.It is the components which run in backgrounds to perform long running operation or to perform remote operation.service is implemented as a subclass of Service
  • Content Providers- it is helpful for storing the data for application.you can perform query operation with stored data. Android has given  SQLite database for storing data on the web.contents providers is implemented as subclass of ContentProvider.
  • Broadcast Receivers - it is a components that respond to a system with a wide broadcast announcements. It does not provide user interface.A broadcast receivers is implemented as a subclass of BroadcastReceivers. each broadcast is delivered as a intent objects.
  • Activating Components- activities,services, broadcast receivers are activated by asynchronous message called as Intent.Intent bind each components at run time.An Intent is created with an intent object.fourth components content providers is activated when targeted by a request from content resolver.
  • Methods for activating components.
  1. Activity is activated by passing an intent to startActivity() or startActivityResult() (for returning result).
  2. Service is activated by passing an intent to startService() or bindService() (for bind to service).
  3. Broadcast is activated by passing an intent to sendBroadcast() or sendOrderedBroadcast() or sendStickyBroadcast( ).
  4. Content Provider is activated by calling query() to content resolver.

8 Nov 2012


Main and launcher in AndroidManifest.xml

AndroidManifest.xml is the root of project directory.
Android manifest.xml

  • on selecting the app icon from home screen the system calls for the oncreate() method for the activity in  app.
  • <intent-filter> is included in the main activity of manifest file which includes the main action and launcher categories 
  • Application icon will not appear in home screen if main action and launcher activities are not declared for any of the activity of app.

7 Nov 2012


Introduction to Android

  • Android has the following features:

Android

  • Android application are archived in .apk file contain both data and resource files.
  • Android application are written in java language.
  • Android OS is a multi-user linux system in which every application is a different user.
  • linux assigns each application a unique user id by default. 
  • Each application code runs in isolation as each application has it own virtual machine.

6 Nov 2012


Android virtual machine and its configuration.

AVD is used to test the developed app with no need of real android device.A developer can configures the AVD on various version of Android.
procedures of configuring AVD.

  1. open eclipse and select AVD manager.
  2. in the resulting AVD manager window select new button on the right.
  3. now after clicking on new button various values you need to set up.
AVD
  • name - you can give the name for your android app.
  • target - it has two option ,select Android 4.1- API level 16  if you don't need Google map API capability and select Google APIs(Google Inc.) API level 16  if you want to use Google map APIs capability.
  • SD card size - enter 1024 mib by default.
  • Snapshot -don't select snapshot if you have enabled graphics acceleration because snapshot are not supported with them.
  • Skin - select built-in and Default(WVGA800).
  • Hardware - select given hardware from the list as per app requirements.

Know More about AndroidManifest.xml File

A manifest file gives description about Describe fundamental characteristic of App and define each of its application features:
Android Manifest.xml
  • Gives the name of java package for app which are unique identifier for application.
  • Identifies which process will host app components.
  • Declares permission for app regarding to access protected part of API and interaction with other app.
  • Also lists the links of libraries that app uses.
  • List the minimum level of android API application require. 
  • Illustrates components of app that is activities,services,broadcast receivers, and content providers that app is made of.Also name the class to implements each of the components.

5 Nov 2012


Main directories and files of Android projects

Every Android project necessarily have these files and directories.
  1. AndroidManifest.xml file  -Explain fundamental characteristic of app and defines each of its components.
  2. src/  -it is the directory of main source file and by default includes an Activity class which run when app is running.
  3. res/  -it contain sub directories of application resources. 
Android Project
  • drawable-hdpi/ - stores drawable objects in directory designed for high density screen.
  • drawable-mdpi/- stores drawable objects in directory designed for medium density screen.
  • drawable-ldpi/- stores drawable objects in directory designed for low density screen.
  • layout/ -it is the directories which defines user interface.
  • value/- contain various xml file which contain collection of resources.

3 Nov 2012


Android SDK recommended and available packages.

There are many packages available in Android some are recommended and some are useful for specific purposes.
Recommended packages.
  1. SDK Tools- it is a downloaded components of Android SDK which includes a complete set of development and debugging tools for the Android SDK.
  2. SDK Platform Tools- it contain the platform dependent tools for developing and debugging the application and it support the latest features of the android application.
  3. SDK Platform- for each version of Android one Android SDK Platform is available. It includes anandroid.jar file with a fully compliant Android Library
  4. System Image- every platform version gives one or more different system images required by Android emulators.It helps to test the app on latest version of Android in Virtual machine.
  5. Android Support- it is a static library which contain version of the fragments classes and viewpager  API allows  to build a side-swipeable UI. These API's are not available in standard API's.
  6. SDK Samples- a collection of sample application which demonstrate variety of platform API's.
Other available packages
  1. Documentation- an offline documentation of  Android latest platform API's.
  2. Sources for Android SDK- copy of platform source code useful for debugging your app through source code.
  3. Google API's- an add-on provide both a platform to develop an app using special Google API's and a system images for emulator to test app using Google API's.
  4. Google play billing-provides static library and samples helps in integrating billing services in app with Google play
  5. Google play licensing-provides static libraries and samples to perform license verification of app when distributing app with Google play.

2 Nov 2012


How to install Android sdk?

Install the Android sdk involves requires following steps.
Android SDK
  1. First download Android Software Development Kit  (SDK). Download from here
  2. Double click on the SDK Manager.exe file from the root directory of Android SDK.
  3. Now when you open Android SDK manager it will show automatically the required package to be installed.Then click on install button.
  4. To know more about the package click here.
  5. Android SDK manager will install the downloaded package in android SDK environment.

Tools requires to develop first android application.

Software tools requires for developing the android application.
  1. Java SE Develop Kit (JDK), required by Android sdk, and instal the JDK. Download from here
  2. Android Software Development Kit (ADK) .Download from here
  3. Now Install the android sdk.
  4. Install the eclipse preferably Eclipse Classic.Download from here.
  5. Then install ADT Plugin in Eclipse.
  6. Now  you are ready to develop your first android application.

Translate