Posts

Showing posts from October, 2011

Intents and Notifications

Intents   Intents are the messages that are used to activate following application components  Activities  Services  Broadcast Receivers Intent is an object, which has a data structure holding any one of the following data : Abstract description of an operation to be performed  In the case of broadcasts, a description of something that has happened and is being announced. Invoking Components Application components are invoked through intents in the following way :  Activity : Intent object is passed to following functions to invoke the Activity.  Context.startActivity (Intent intent)  Activity.startActivityForResult (Intent intent, int requestCode) Service : Intent object is passed to following functions to invoke the Service. Context.startService (Intent) Context.bindService (Intent) Broadcast Receivers : Intent object is passed to following functions to invoke the Broadcast Receiver. Context.sendBroadcast ( Intent intent, String receiverPermission) Context.sendOrde

Android: Menus and Dialogs

Image
Table of contents: 1. Menus Options menu Context menu Sub menu Creating different Menus 2. Dialogs  Alert Dialog Progressbar dialog DatePicker dialog TimePicker Dialog Toast Creating different dialogs  Menus Menus provide familiar interfaces to expose application functions without sacrificing screen space.  Android offers an easy programming interface to provide standardized application menus.   Android offers three fundamental types of application menus:  Options Menu   Context Menu   Sub-menu Options Menu: By default, every Activity supports an Options menu of actions or options. It is revealed by pressing the device MENU key. Options Menu has two groups of menu items:   Icon Menu   Collection of maximum of six menu items   Supports Icons and short-cuts   Expanded Menu   Exposed by the 'More' menu item   Displayed when the icon menu becomes over-loaded   Comprised of sixth options menu item and the rest. Create Options

Android User Interface : Life cycles and Layouts

Image
  Activity  Creating Activity Activity Lifecycle Activity Lifetime Starting Activity Process Lifecycle 2. Layouts  Creating Layout Types of layout Layout parameters Activity: An Activity presents a visual user interface for one focused endeavor the user can undertake. Each Activity represents a screen (similar to the concept of a Form in desktop development) that an application can present to its users. Most Activities are designed to occupy the entire display, but you can create Activities that are semi-transparent, floating (Activity working as a dialog). Creating an Activity:  Create a new Activity by extending the Activity class.   Override the onCreate() method to set the view for the activity   Set the user interface to an Activity using the setContentView method in the onCreate method of the Activity.   Use the findViewById(int) method to retrieve the reference of the widgets in UI.   The basic skeleton code for a new activity is shown below : public cla