Skip to content

Using Android Intents Tutorial

Intents are just what they sound like, a way to declare to the Android Framework what you intend to do. This can be starting a specific activity, or it can be just asking Android to find some program that can perform an action (whether or not you know what programs are available). We can also go in the other direction, and determine what actions are available to us for a particular piece of content. We are going to cover each of these topics in this article.

In this article I showed you how to open a specific activity using the startActivity method and an Intent that specifies a class. This is just the tip of the iceberg when it comes to using intents.

Here is the basic activity I am going to be using for the rest of this article. At this point, it is just a ListActivity which is going to reference the different examples we are going to see.

package com.learnandroid.intents;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
public class UsingIntentsActivity extends ListActivity {
    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {
        ListAdapter adapter = createAdapter();
    protected ListAdapter createAdapter()
    	String[] listValues = new String[] {
    			"The Activity You Know",
    			"The URI You Know",
    			"When You Just Don't Know"
    	// Create a simple array adapter (of type string) with the test values
    	ListAdapter adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1
    			, listValues);
    	return adapter;

Next: The Activity You Know

{ 6 } Comments

  1. shub | May 30, 2012 at 5:07 pm | Permalink

    i am new to android can you please explain what is onclicklistner (not what is does) and why we use View.onclicklistner and what is view there

  2. krishna | August 10, 2012 at 2:19 am | Permalink

    very useful, thaks..

  3. dinesh | February 10, 2014 at 3:24 am | Permalink

    wow…amazing…you give simple and easy look to android layout…..

    thank you very much

  4. fixit | April 11, 2014 at 11:56 am | Permalink

    great post, very useful for beginers

  5. Alex Butler | September 27, 2014 at 3:59 am | Permalink

    Will you accept guest post content?

  6. Sheridan | September 27, 2014 at 7:28 am | Permalink

    Sure, I would be willing to accept a guest post. Basically, my criteria would be that I should be able to open Eclipse, go through your tutorial step by step, and have it work without needed to figure out any extra stuff.

    Basically, I started this website with a friend (he wrote the lots of lists post). I was very gung ho about it… and then I found myself going through a divorce. I’ve kicked around the idea of starting to do tutorials again, and would be glad to have new content on here.

Post a Comment

Your email is never published nor shared. Required fields are marked *