Saturday, 17 March 2012

More to learn

API Level is an integer value that uniquely identifies the framework API. (version :Android 2.1.x, API Level: 7)


INTENT

Three of the core components of an application — activities, services, and broadcast receivers — are activated through messages, called intents.
Intent i = new Intent(Intent.ACTION_VIEW); 
startActivity(i);

<intent-filter>    -> Specifies the types of intents

UNITS OF MEASUREMENT

px    Pixels - corresponds to actual pixels on the screen.
in    Inches - based on the physical size of the screen.
mm    Millimeters - based on the physical size of the screen.
pt    Points - 1/72 of an inch based on the physical size of the screen.

dp    Density-independent Pixels - an abstract unit that is based on the physical density of the screen.
These units are relative to a 160 dpi screen, so one dp is one pixel on a 160 dpi screen.
The ratio of dp-to-pixel will change with the screen density, but not necessarily in direct proportion.
Note: The compiler accepts both "dip" and "dp", though "dp" is more consistent with "sp".

sp    Scale-independent Pixels - this is like the dp unit, but it is also scaled by the user's font size preference.
It is recommend you use this unit when specifying font sizes, so they will be adjusted for
both the screen density and user's preference.

Toast

  1. A toast notification ia similar to popup
  2. automatically fades in and out, and does not accept interaction events.
  3. A toast can be created and displayed from an Activity or Service
  4. It has three parameters, Ex: Toast toast = Toast.makeText(context, text, duration);
  5. Display it using, "toast.show();"
  6. Constants   LENGTH_LONG , LENGTH_SHORT

ArrayAdapter http://www.vogella.de/articles/AndroidListView/article.html

  1. An adapter which is used to ListView the String must extend BaseAdapter.
  2. Among several standard adapters, important are ArrayAdapter and CursorAdapter. 
  3. ArrayAdapter can handle data based on Arrays or Lists.
  4. SimpleCursorAdapter handle database related data.
  5. Methods:
    public ArrayAdapter (Context context, int resource, int textViewResourceId)
    public ArrayAdapter(Context context, int resource, int textViewResourceId, T[] objects)
    public ArrayAdapter (Context context, int resource, int textViewResourceId, List<T> objects)
 
    context        The current context.
    resource        The resource ID for a layout file containing a layout to use when instantiating views.
    textViewResourceId    The id of the TextView within the layout resource to be populated
    objects        The objects to represent in the ListView.
 
  6. Change data in the Adapter using clear(), add(), addAll(),
  7. Filtering lists(ListView) using adapter.getFilter().filter(searchString)


Notifications

Notifications are the messages in the status bar at the top of the screen. They’re handy to do stuff like notifying the user of new, unread e-mail in a background service, even if he’s not currently inside the e-mail application (this is exactly what the GMail app does). The following is the code necessary to display a notification:

Learn : http://android10.org/index.php/articlesuserinterface/257-creating-status-bar-notifications

No comments:

Post a Comment