Posts

16 BroadCast Receiver using Manifest file

Broadcasts overview Android apps can send or receive broadcast messages from the Android system and other Android apps, similar to the  publish-subscribe  design pattern. These broadcasts are sent when an event of interest occurs. For example, the Android system sends broadcasts when various system events occur, such as when the system boots up or the device starts charging. Apps can also send custom broadcasts, for example, to notify other apps of something that they might be interested in (for example, some new data has been downloaded). Apps can register to receive specific broadcasts. When a broadcast is sent, the system automatically routes broadcasts to apps that have subscribed to receive that particular type of broadcast. NOTE: However, you must be careful not to abuse the opportunity to respond to broadcasts and run jobs in the background that can contribute to a slow system performance. About system broadcasts The system automatically sends broadcas...

15 AsyncTask

public abstract class AsyncTask  extends  Object   AsyncTask enables proper and easy use of the UI thread.  This class allows you to perform background operations and publish results on the UI thread without having to manipulate threads and/or handlers. AsyncTask is designed to be a helper class around  Thread  and  Handler  and does not constitute a generic threading framework. AsyncTasks should ideally be used for short operations (a few seconds at the most.) An asynchronous task is defined by a computation that runs on a background thread and whose result is published on the UI thread.  An asynchronous task is defined by 3 generic types, called  Params ,  Progress  and  Result , and  4 steps, called  onPreExecute ,  doInBackground , onProgressUpdate  and  onPostExecute . USAGE: AsyncTask must be subclassed to be used. The subclass will override at least one method ( doInBa...