Escolar Documentos
Profissional Documentos
Cultura Documentos
{
// TODO Auto-generated method stub super.onRestoreInstanceState(savedInstanceState); int color = savedInstanceState.getInt("color"); //myWidget.setBackgroundColor(color); }
E.g. when the screen rotates. Not when using the back key
Intents
What is an intent
An intent is an abstract description of an operation to be performed It can be used to
Implicit intents
do not name a target. Implicit intents are often used to activate components in other applications.
Intent Structure
Action -- The general action to be performed, such as ACTION_VIEW
ACTION_EDIT
ACTION_MAIN Data -- The data to operate on, such as a person record in the contacts database, expressed as a Uri. E.g. Open contact from contacts named John Steve Intent with ACTION_VIEW and data name of contact
Exercise
Make an application that takes a phone number as input and click a button to call. Call immediately, do not show the dialer
Types
Types of data/message related to the intents as we saw in previous examples Extras Extra information needed for handling the intent by the intent receiver
Intents Examples
Some times the action/data pairs are not enough information to the activity. E.g. sending SMS Action : SendSMS
Data : to whom
What about the message itself ? Thats why there are Secondary attributes.