satya - Saturday, September 27, 2008 9:04:47 PM
what are intent extras
what are intent extras
satya - Sunday, September 28, 2008 8:22:11 PM
earlier notes on intent
In a web application in response to an action such as a button click, one might want to transfer the user to a new page or a screen. This is done typically done through a URL.
A url has an action to invoke and a set of parameters to resolve the data to display.
Put together, the set of actions, data types, categories, and extra data defines a language for the system allowing for the expression of phrases such as "call john smith's cell". As applications are added to the system, they can extend this language by adding new actions, types, and categories, or they can modify the behavior of existing phrases by supplying their own activities that handle them.
satya - Sunday, September 28, 2008 8:41:13 PM
An intent is used for the following things
startActivity broadcastintent startservice bindservice
satya - Sunday, September 28, 2008 8:42:52 PM
It has 4 parts
action constant data uri category type component extras
satya - Sunday, September 28, 2008 8:44:46 PM
type
type
satya - Sunday, September 28, 2008 8:45:19 PM
type is the explicit type of data. give an example of how to use this
type is the explicit type of data. give an example of how to use this
satya - Sunday, September 28, 2008 8:46:40 PM
type seems to be only MIME type
type seems to be only MIME type
satya - Sunday, September 28, 2008 8:47:05 PM
where as a Component may be class name
where as a Component may be class name
satya - Sunday, September 28, 2008 8:48:08 PM
extras is a bundle of information where bundle is a class
extras is a bundle of information where bundle is a class
satya - Sunday, September 28, 2008 8:51:34 PM
How many mime types are there?
How many mime types are there?
satya - Sunday, September 28, 2008 8:51:56 PM
How many categories are there?
How many categories are there?
satya - Sunday, September 28, 2008 8:56:10 PM
There are two kinds of intents: Implicit and Explicit
There are two kinds of intents: Implicit and Explicit
satya - Sunday, September 28, 2008 8:58:35 PM
what are components and how are they different from classes?
what are components and how are they different from classes?
satya - Sunday, September 28, 2008 9:06:12 PM
Algorithm for intent resolution
Intent resolution is how the system matches up an intent or an event with its target like say an activity. It uses "action", "type", "scheme", and "categories" of the incoming intent.
satya - Sunday, September 28, 2008 10:26:26 PM
See if this article throws some light on this
satya - Monday, September 29, 2008 10:22:52 AM
The algorithm
There are three pieces of information in the Intent that are used for resolution: the action, type, and category. Using this information, a query is done on the PackageManager for a component that can handle the intent. The appropriate component is determined based on the intent information supplied in the AndroidManifest.xml file as follows:
The action, if given, must be listed by the component as one it handles.
The type is retrieved from the Intent's data, if not already supplied in the Intent. Like the action, if a type is included in the intent (either explicitly or implicitly in its data), then this must be listed by the component as one it handles.
For data that is not a content: URI and where no explicit type is included in the Intent, instead the scheme of the intent data (such as http: or mailto:) is considered. Again like the action, if we are matching a scheme it must be listed by the component as one it can handle.
The categories, if supplied, must all be listed by the activity as categories it handles. That is, if you include the categories CATEGORY_LAUNCHER and CATEGORY_ALTERNATIVE, then you will only resolve to components with an intent that lists both of those categories. Activities will very often need to support the CATEGORY_DEFAULT so that they can be found by Context.startActivity().
satya - Monday, September 29, 2008 10:23:33 AM
Example of intent declarations
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.notepad">
<application android:icon="@drawable/app_notes"
android:label="@string/app_name">
<provider class=".NotePadProvider"
android:authorities="com.google.provider.NotePad" />
<activity class=".NotesList" android:label="@string/title_notes_list">
<intent-filter>
<action android:value="android.intent.action.MAIN" />
<category android:value="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:value="android.intent.action.VIEW" />
<action android:value="android.intent.action.EDIT" />
<action android:value="android.intent.action.PICK" />
<category android:value="android.intent.category.DEFAULT" />
<type android:value="vnd.android.cursor.dir/vnd.google.note" />
</intent-filter>
<intent-filter>
<action android:value="android.intent.action.GET_CONTENT" />
<category android:value="android.intent.category.DEFAULT" />
<type android:value="vnd.android.cursor.item/vnd.google.note" />
</intent-filter>
</activity>
<activity class=".NoteEditor" android:label="@string/title_note">
<intent-filter android:label="@string/resolve_edit">
<action android:value="android.intent.action.VIEW" />
<action android:value="android.intent.action.EDIT" />
<category android:value="android.intent.category.DEFAULT" />
<type android:value="vnd.android.cursor.item/vnd.google.note" />
</intent-filter>
<intent-filter>
<action android:value="android.intent.action.INSERT" />
<category android:value="android.intent.category.DEFAULT" />
<type android:value="vnd.android.cursor.dir/vnd.google.note" />
</intent-filter>
</activity>
<activity class=".TitleEditor" android:label="@string/title_edit_title"
android:theme="@android:style/Theme.Dialog">
<intent-filter android:label="@string/resolve_title">
<action android:value="com.android.notepad.action.EDIT_TITLE" />
<category android:value="android.intent.category.DEFAULT" />
<category android:value="android.intent.category.ALTERNATIVE" />
<category android:value="android.intent.category.SELECTED_ALTERNATIVE" />
<type android:value="vnd.android.cursor.item/vnd.google.note" />
</intent-filter>
</activity>
</application>
</manifest>
satya - Monday, September 29, 2008 10:26:24 AM
I need more information on default category
I need more information on default category
satya - Monday, September 29, 2008 10:37:21 AM
Note that the intent filter does not have a "data" child node.
Typically an intent would have mentioned the action, might have mentioned the category, and also a type (but more likely data).
It is the provider satisfying the data uri that gives out the mime type. Based on this mime type an intent filter is picked up.
So data is really an input to an intent filter but won't be needed for describing the intent.
satya - Monday, September 29, 2008 10:41:16 AM
relationship between an action and an activity
Does an activity have to do something special based on action it supports.
For example for a PICK action, does the activity need to write a call back for that action and do somethign differently?
satya - Monday, September 29, 2008 10:45:54 AM
Explanation for DEFAULT
DEFAULT means that this action can be considered a default action for the type of data specified - i.e. something requesting the default action for a particular data item can get sent straight to this intent. It's like saying "I know this one, let me handle it"
satya - Monday, September 29, 2008 10:46:46 AM
ALTERNATIVE
ALTERNATIVE means that this can act as one of the alternatives that the user can select to handle a particular request or item. If there are several alternatives, the user will (or may) be prompted as to which one to use.
satya - Monday, September 29, 2008 10:48:15 AM
SELECTED_ALTERNATE
SELECTED_ALTERNATIVE means that the action applies to something the user currently has selected.
satya - Monday, September 29, 2008 5:05:17 PM
alternative and selected alternative
These are used for adding menu items to other applications of new actions your own application can perform on the data being shown by the other app.
satya - Monday, September 29, 2008 10:59:39 PM
what is urimatcher and why would one use it and how to use it?
what is urimatcher and why would one use it and how to use it?
satya - Tuesday, September 30, 2008 8:13:29 AM
If an intent carries data with it what is the nature of this data
It is possible that this data can be open ended. But is it? Yes and no. It is not because the method "getData" from an intent returns a "uri". Which means irrespective of the data an intent wants to carry with it it takes the form of a "uri". A uri is like a http url. So the receiver must call the url to open the stream to receive data. Or you can use additional arguments from the url. Because the provider of that url can provide any data structure back the answer is also yes. In addition the intent carries another "fixed" data object called a Bundle which is a collection key value pairs.
satya - Tuesday, September 30, 2008 8:14:59 AM
How does a receiver retrieve data from a an intent or a uri to be specific?
How does a receiver retrieve data from a an intent or a uri to be specific?
satya - Tuesday, September 30, 2008 8:15:52 AM
How does the receiver of an intent know the mime type of the data?
How does the receiver of an intent know the mime type of the data?
satya - Tuesday, September 30, 2008 8:17:17 AM
How does the intent resolver know the mime type of an intents data?
How does the intent resolver know the mime type of an intents data?
satya - Tuesday, September 30, 2008 9:02:41 AM
What is ContentResolver?
What is ContentResolver?
satya - Tuesday, September 30, 2008 9:04:27 AM
String getType(uri): returns mime type of the uri
String getType(uri): returns mime type of the uri
satya - Tuesday, September 30, 2008 9:04:53 AM
How does ContentResolver know the mime type of a uri?
How does ContentResolver know the mime type of a uri?
Search for: How does ContentResolver know the mime type of a uri?
satya - Tuesday, September 30, 2008 9:09:22 AM
It is important you read ContentProvider
satya - Tuesday, September 30, 2008 9:58:33 AM
How do you locate a provider based on android content uri
How do you locate a provider based on android content uri
Search for: How do you locate a provider based on android content uri
satya - Tuesday, September 30, 2008 12:49:23 PM
Read about content providers
satya - Tuesday, September 30, 2008 12:50:12 PM
provider android content url structure
satya - Tuesday, September 30, 2008 12:57:01 PM
The above is an excellent article
The above is an excellent article
satya - Thursday, October 09, 2008 8:22:08 PM
You can find a list of intents here
satya - Thursday, October 09, 2008 8:37:48 PM
where can I find the various android provider URIs listed?
where can I find the various android provider URIs listed?
Search for: where can I find the various android provider URIs listed?
satya - Friday, October 10, 2008 12:02:44 PM
Where can I find android constants for permissions
Where can I find android constants for permissions
Search for: Where can I find android constants for permissions
satya - Saturday, October 11, 2008 9:12:55 AM
A list of uris can be found here
satya - Saturday, October 11, 2008 9:34:38 AM
A relevent discussion on content providers
satya - Saturday, October 11, 2008 9:51:54 AM
Android Parcel, JSON, Serialize, binding
Android Parcel, JSON, Serialize, binding
satya - Friday, October 31, 2008 10:46:19 AM
Example of dialling anumber
private void dialWithNumber(String tel)
{
String telUriString = "tel:" + tel;
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse(telUriString));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(intent);
}
satya - Friday, October 31, 2008 11:05:16 AM
Invoking a browser
private void invokeWebBrowser()
{
this.appendText("Invoke Browser invoked");
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://www.google.com"));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(intent);
}
satya - Friday, October 31, 2008 1:30:58 PM
How does android know what activity to invoke based on a uri?
How does android know what activity to invoke based on a uri?
Search for: How does android know what activity to invoke based on a uri?
satya - Friday, October 31, 2008 1:31:29 PM
deliverNewIntents activitythread.java
deliverNewIntents activitythread.java
satya - Friday, October 31, 2008 1:55:19 PM
xml representation for intent filter
satya - Friday, October 31, 2008 1:58:08 PM
data tag of an intent filter
satya - Friday, October 31, 2008 2:18:30 PM
Example of a filter that specifies mimetype
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" />
<action android:name="android.intent.action.PICK" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.dir/vnd.google.note" />
</intent-filter>
satya - Saturday, November 01, 2008 9:08:19 AM
is there a default behavior for setFlags in Android?gquestion
is there a default behavior for setFlags in Android?gquestion
satya - Saturday, November 01, 2008 9:08:54 AM
is there a default behavior for setFlags in Android?
is there a default behavior for setFlags in Android?
Search for: is there a default behavior for setFlags in Android?
satya - Saturday, November 01, 2008 9:09:18 AM
search the developers group
satya - Saturday, November 01, 2008 9:21:25 AM
An important discussion to follow on the activity invocation
An important discussion to follow on the activity invocation
satya - Saturday, November 01, 2008 9:47:04 AM
How do android permissions work?
How do android permissions work?
satya - Wednesday, November 05, 2008 4:13:08 PM
Makesure you read through the following IBinder doc
satya - Wednesday, November 05, 2008 4:13:50 PM
related apis
Bundle
Parcelable
Parcel
IBinder
satya - Wednesday, November 05, 2008 10:00:25 PM
You need to understand searchmanager
satya - Wednesday, November 05, 2008 10:30:00 PM
A discussion on the DEFAULT category
satya - Thursday, November 06, 2008 10:31:53 AM
exercise content provided intents
exercise content provided intents
satya - Friday, November 07, 2008 10:06:12 AM
How to replace the home page
satya - Friday, November 07, 2008 10:10:13 AM
A nice thread about internals do read
satya - Friday, November 07, 2008 10:20:52 AM
How to start multiple activities
satya - Friday, November 07, 2008 10:21:35 AM
Search for multiple activities
satya - Friday, November 07, 2008 12:58:47 PM
Use notepad intents to test
Use notepad intents to test
satya - Friday, November 07, 2008 1:34:00 PM
Read about startActivityWithResult
satya - Saturday, November 08, 2008 9:57:31 AM
sample code and usage for starting activites and getting results
sample code and usage for starting activites and getting results
satya - Sunday, November 09, 2008 7:50:38 AM
My items on android developers group
satya - Sunday, November 09, 2008 7:51:55 AM
Sorry this is the right link
satya - Sunday, November 09, 2008 9:12:22 AM
Make sure i include
extra names
actions
flags
satya - Monday, January 05, 2009 11:57:53 AM
Invoke a start activity for feedback
public static void invokePick(Activity activity)
{
Intent pickIntent = new Intent(Intent.ACTION_PICK);
//pickIntent.setData(Contacts.CONTENT_URI);
pickIntent.setData(Uri.parse(
"content://com.google.provider.NotePad/notes"));
activity.startActivityForResult(pickIntent, 1);
}
satya - Monday, January 05, 2009 11:59:14 AM
parsing the results
public static void parseResult(HelloWorldActivity activity
, int requestCode
, int resultCode
, Intent outputIntent)
{
activity.appendText("parseResult called");
if (requestCode != 1)
{
activity.appendText("Some one else called this. not me");
return;
}
if (resultCode != Activity.RESULT_OK)
{
activity.appendText("Result code is not ok:" + resultCode);
return;
}
activity.appendText("Result code is ok:" + resultCode);
activity.appendText("The output uri:");
activity.appendText(outputIntent.getData().toString());
}
satya - Monday, January 05, 2009 12:00:27 PM
resutl back
protected void onActivityResult(int requestCode
,int resultCode
,Intent outputIntent)
{
super.onActivityResult(requestCode, resultCode, outputIntent);
IntentsUtils.parseResult(this, requestCode, resultCode, outputIntent);
}
satya - Monday, January 05, 2009 5:23:32 PM
What is an Android chooser?
What is an Android chooser?
Search Google for: What is an Android chooser?
Search Android Developers Group for: What is an Android chooser?
Search Android Beginers Group for: What is an Android chooser?
Search Google Code for: What is an Android chooser?
Search Android Issues Database for: What is an Android chooser?
satya - Monday, January 05, 2009 5:25:13 PM
Android createChooser
Android createChooser
Search Google for: Android createChooser
Search Android Developers Group for: Android createChooser
Search Android Beginers Group for: Android createChooser
satya - Monday, January 05, 2009 5:49:36 PM
How to invoke a getContent
public static void invokeGetContent(Activity activity)
{
Intent pickIntent = new Intent(Intent.ACTION_GET_CONTENT);
pickIntent.setType("vnd.android.cursor.item/vnd.google.note");
activity.startActivityForResult(pickIntent, 2);
}
satya - Monday, January 05, 2009 6:38:55 PM
Read this code and see what it does
satya - 2/21/2014 3:15:00 PM
Openintents.org is now at code.google.com/p/openintents