Home | History | Annotate | Download | only in app

Lines Matching defs:intent

20 import android.content.Intent;
35 * 2. Any time the user clicks on an installed shortcut, an intent is sent.
40 * of an {@link android.content.Intent} that the launcher will use to create the shortcut.
47 * of the incoming {@link android.content.Intent}.
49 * In a real application, you would probably use the shortcut intent to display specific content
60 // Resolve the intent
62 final Intent intent = getIntent();
63 final String action = intent.getAction();
65 // If the intent is a request to create a shortcut, we'll do that and exit
67 if (Intent.ACTION_CREATE_SHORTCUT.equals(action)) {
73 // If we weren't launched with a CREATE_SHORTCUT intent, simply put up an informative
80 // Provide a lightweight view of the Intent that launched us
83 String info = intent.toString();
84 String extra = intent.getStringExtra(EXTRA_KEY);
95 * The first intent serves as a container for the shortcut and is returned to the launcher by
96 * setResult(). This intent must contain three fields:
99 * <li>{@link android.content.Intent#EXTRA_SHORTCUT_INTENT} The shortcut intent.</li>
100 * <li>{@link android.content.Intent#EXTRA_SHORTCUT_NAME} The text that will be displayed with
102 * <li>{@link android.content.Intent#EXTRA_SHORTCUT_ICON} The shortcut's icon, if provided as a
103 * bitmap, <i>or</i> {@link android.content.Intent#EXTRA_SHORTCUT_ICON_RESOURCE} if provided as
108 * {@link android.content.Intent.ShortcutIconResource}, as shown below. This is required so
111 * bundle using {@link android.content.Intent#EXTRA_SHORTCUT_ICON}.
113 * The shortcut intent can be any intent that you wish the launcher to send, when the user
114 * clicks on the shortcut. Typically this will be {@link android.content.Intent#ACTION_VIEW}
115 * with an appropriate Uri for your content, but any Intent will work here as long as it
119 // First, set up the shortcut intent. For this example, we simply create an intent that
124 Intent shortcutIntent = new Intent(Intent.ACTION_MAIN);
128 // Then, set up the container intent (the response to the caller)
130 Intent intent = new Intent();
131 intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
132 intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.shortcut_name));
133 Parcelable iconResource = Intent.ShortcutIconResource.fromContext(
135 intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconResource);
139 setResult(RESULT_OK, intent);