Android Handbook

Post date: Feb 21, 2017 11:32:52 AM

App Restriction:


Layout:

Linear Layouts is a view group that aligns all children in a single direction, vertically or horizontally

Relation Layouts is a view group that displays child views in relative positions

Recycler View

List View

Grid View

Intent Types:

Activity:

Fragments:

A Fragment represents a behavior or a portion of user interface in an Activity.

Fragment is added

onAttach()

onCreate()

onCreateView()

onActivityCreated()

onStart()

onResume()

Fragment is active

onPause()

onStop()

onDestroyView()

onDestroy()

onDetach();

Fragment is destored()

Loader:

Loader API lets you load data from a content provider or other data source for display in an Activity or Fragment.

Services

A service runs in the main thread of its hosting process; the service does not create its own thread and does not run in a separate process unless you specify otherwise

onStartCommand()

The system invokes this method by calling startService() when another component (such as an activity) requests that the service be started. When this method executes, the service is started and can run in the background indefinitely

onBind()

The system invokes this method by calling bindService() when another component wants to bind with the service (such as to perform RPC). In your implementation of this method, you must provide an interface that clients use to communicate with the service by returning an IBinder. You must always implement this method; however, if you don't want to allow binding, you should return null.

onCreate()

The system invokes this method to perform one-time setup procedures when the service is initially created (before it calls either onStartCommand() or onBind()). If the service is already running, this method is not called.

onDestroy()

IntentService

This is a subclass of Service that uses a worker thread to handle all of the start requests, one at a time

START_NOT_STICKY

If the system kills the service after onStartCommand() returns, do not recreate the service unless there are pending intents to deliver

START_STICKY

Music player -> will restart, but not persist data

START_REDELIVER_INTENT

Download and upload process -> Restart and perceive the data

Broadcasts:

Sending broadcasts

Broadcast receiver:

BroadcastReceiver