Vincent Tsao's Library tagged → View Popular, Search in Google
-
While I was playing around with the emulator, I noticed that if you try to view a YouTube video in it th browser gives an error similar to
Cannot open the page at vnd.youtube:VIDEO_ID?some=other¶meters=here. This way, I learned that aVIEWintent with a data URI likevnd.youtube:VIDEO_IDwill launch the official YouTube app (this was confirmed by some nice folks on IRC, as I don't have an Android device). -
Here is how to get video id from a link
Uri uri = Uri.parse(url);
String vid = uri.getQueryParameter("v");
-
This article describes a technique you can use to find out whether the system contains any application capable of responding to the intent you want to use. The example below shows a helper method that queries the system package manager to determine whether there's an app that can respond to a specified intent. Your application can pass an intent to the method and then, for example, show or hide user options that the user would normally use to trigger the intent.
-
/**
* Indicates whether the specified action can be used as an intent. This
* method queries the package manager for installed packages that can
* respond to an intent with the specified action. If no suitable package is
* found, this method returns false.
*
* @param context The application's environment.
* @param action The Intent action to check for availability.
*
* @return True if an Intent with the specified action can be sent and
* responded to, false otherwise.
*/
public static boolean isIntentAvailable(Context context, String action) {
final PackageManager packageManager = context.getPackageManager();
final Intent intent = new Intent(action);
List<ResolveInfo> list =
packageManager.queryIntentActivities(intent,
PackageManager.MATCH_DEFAULT_ONLY);
return list.size() > 0;
} - 1 more annotation(s)...
-
Intent videoClient = new Intent(Intent.ACTION_VIEW);
videoClient.setData(Uri.parse("http://m.youtube.com/watch?v="+videoId));
videoClient.setClassName("com.google.android.youtube", "com.google.android.youtube.PlayerActivity");
startActivityForResult(videoClient, VIDEO_APP);
-
I am just making some AppWidget and I want to pass some Strings
through UpdateView to an Activity. But the Bundle is null.
I try this:
-Widget.java
Intent defineIntent = new Intent(context,
Visor.class);
defineIntent.putExtra
("org.rss.androides.post2","artist");
PendingIntent pendingIntent =
PendingIntent.getActivity(context, 0, defineIntent, 0);
updateViews.setOnClickPendingIntent
(R.id.widget, pendingIntent);
-Viewer.java
Bundle b = intent.getExtras();
if (b == null) {
finish();
return;
}
b is always null.
-
Remember that PendingIntents aren't keyed using extras:
http://groups.google.com/group/android-developers/msg/b296f43ae70c4587
You could hack the extras through by mangling them into Uri
parameters, or if you're using a ContentProvider, just point to a
specific row. - 1 more annotation(s)...
-
<p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; font-family: '宋体';">1<span style="font-family: 宋体;">,掉web浏览器</span></span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">Uri </span><span style="background: rgb(192, 192, 192) none repeat scroll 0% 0%; font-size: 10.5pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); font-family: 'Courier New';">myBlogUri</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';"> = Uri.</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-style: italic; font-family: 'Courier New';">parse</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">(</span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: 'Courier New';">"http://kuikui.javaeye.com"</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">returnIt = </span><span style="font-weight: bold; font-size: 10.5pt; color: rgb(127, 0, 85); font-family: 'Courier New';">new</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';"> Intent(Intent.</span><span style="font-size: 10.5pt; color: rgb(0, 0, 192); font-style: italic; font-family: 'Courier New';">ACTION_VIEW</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">, </span><span style="background: rgb(192, 192, 192) none repeat scroll 0% 0%; font-size: 10.5pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); font-family: 'Courier New';">myBlogUri</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: '宋体';">2<span style="font-family: 宋体;">,地图</span></span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">Uri mapUri = Uri.</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-style: italic; font-family: 'Courier New';">parse</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">(</span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: 'Courier New';">"geo:38.899533,-77.036476"</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">returnIt = </span><span style="font-weight: bold; font-size: 10.5pt; color: rgb(127, 0, 85); font-family: 'Courier New';">new</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';"> Intent(Intent.</span><span style="font-size: 10.5pt; color: rgb(0, 0, 192); font-style: italic; font-family: 'Courier New';">ACTION_VIEW</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">, mapUri);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: '宋体';">3<span style="font-family: 宋体;">,调拨打电话界面</span></span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">Uri telUri = Uri.</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-style: italic; font-family: 'Courier New';">parse</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">(</span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: 'Courier New';">"tel:100861"</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">returnIt = </span><span style="font-weight: bold; font-size: 10.5pt; color: rgb(127, 0, 85); font-family: 'Courier New';">new</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';"> Intent(Intent.</span><span style="font-size: 10.5pt; color: rgb(0, 0, 192); font-style: italic; font-family: 'Courier New';">ACTION_DIAL</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">, telUri);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: '宋体';">4<span style="font-family: 宋体;">,直接拨打电话</span></span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">Uri callUri = Uri.</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-style: italic; font-family: 'Courier New';">parse</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">(</span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: 'Courier New';">"tel:100861"</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">returnIt = </span><span style="font-weight: bold; font-size: 10.5pt; color: rgb(127, 0, 85); font-family: 'Courier New';">new</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';"> Intent(Intent.</span><span style="font-size: 10.5pt; color: rgb(0, 0, 192); font-style: italic; font-family: 'Courier New';">ACTION_CALL</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">, callUri);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: '宋体';">5<span style="font-family: 宋体;">,卸载</span></span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">Uri uninstallUri = Uri.</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-style: italic; font-family: 'Courier New';">fromParts</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">(</span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: 'Courier New';">"package"</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">, </span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: 'Courier New';">"</span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: '宋体';">xxx</span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: 'Courier New';">"</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">, </span><span style="font-weight: bold; font-size: 10.5pt; color: rgb(127, 0, 85); font-family: 'Courier New';">null</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">returnIt = </span><span style="font-weight: bold; font-size: 10.5pt; color: rgb(127, 0, 85); font-family: 'Courier New';">new</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';"> Intent(Intent.</span><span style="font-size: 10.5pt; color: rgb(0, 0, 192); font-style: italic; font-family: 'Courier New';">ACTION_DELETE</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">, uninstallUri);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: '宋体';">6<span style="font-family: 宋体;">,安装</span></span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">Uri installUri = Uri.</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-style: italic; font-family: 'Courier New';">fromParts</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">(</span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: 'Courier New';">"package"</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">, </span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: 'Courier New';">"</span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: '宋体';">xxx</span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: 'Courier New';">"</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">, </span><span style="font-weight: bold; font-size: 10.5pt; color: rgb(127, 0, 85); font-family: 'Courier New';">null</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">returnIt = </span><span style="font-weight: bold; font-size: 10.5pt; color: rgb(127, 0, 85); font-family: 'Courier New';">new</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';"> Intent(Intent.</span><span style="font-size: 10.5pt; color: rgb(0, 0, 192); font-style: italic; font-family: 'Courier New';">ACTION_PACKAGE_ADDED</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">, installUri);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: '宋体';">7<span style="font-family: 宋体;">,播放</span></span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">Uri playUri = Uri.</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-style: italic; font-family: 'Courier New';">parse</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">(</span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: 'Courier New';">"file:///sdcard/download/everything.mp3"</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">returnIt = </span><span style="font-weight: bold; font-size: 10.5pt; color: rgb(127, 0, 85); font-family: 'Courier New';">new</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';"> Intent(Intent.</span><span style="font-size: 10.5pt; color: rgb(0, 0, 192); font-style: italic; font-family: 'Courier New';">ACTION_VIEW</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">, playUri);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: '宋体';">8<span style="font-family: 宋体;">,掉用发邮件</span></span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">Uri emailUri = Uri.</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-style: italic; font-family: 'Courier New';">parse</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">(</span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: 'Courier New';">"mailto:shenrenkui@gmail.com"</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">returnIt = </span><span style="font-weight: bold; font-size: 10.5pt; color: rgb(127, 0, 85); font-family: 'Courier New';">new</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';"> Intent(Intent.</span><span style="font-size: 10.5pt; color: rgb(0, 0, 192); font-style: italic; font-family: 'Courier New';">ACTION_SENDTO</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">, emailUri);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; font-family: '宋体';">9<span style="font-family: 宋体;">,发邮件</span></span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="background: rgb(192, 192, 192) none repeat scroll 0% 0%; font-size: 10.5pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); font-family: 'Courier New';">returnIt</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';"> = </span><span style="font-weight: bold; font-size: 10.5pt; color: rgb(127, 0, 85); font-family: 'Courier New';">new</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';"> Intent(Intent.</span><span style="font-size: 10.5pt; color: rgb(0, 0, 192); font-style: italic; font-family: 'Courier New';">ACTION_SEND</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">String[] tos = { </span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: 'Courier New';">"shenrenkui@gmail.com"</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';"> };</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">String[] ccs = { </span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: 'Courier New';">"shenrenkui@gmail.com"</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';"> };</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="background: rgb(192, 192, 192) none repeat scroll 0% 0%; font-size: 10.5pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); font-family: 'Courier New';">returnIt</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">.putExtra(Intent.</span><span style="font-size: 10.5pt; color: rgb(0, 0, 192); font-style: italic; font-family: 'Courier New';">EXTRA_EMAIL</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">, tos);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="background: rgb(192, 192, 192) none repeat scroll 0% 0%; font-size: 10.5pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); font-family: 'Courier New';">returnIt</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">.putExtra(Intent.</span><span style="font-size: 10.5pt; color: rgb(0, 0, 192); font-style: italic; font-family: 'Courier New';">EXTRA_CC</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">, ccs);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="background: rgb(192, 192, 192) none repeat scroll 0% 0%; font-size: 10.5pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); font-family: 'Courier New';">returnIt</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">.putExtra(Intent.</span><span style="font-size: 10.5pt; color: rgb(0, 0, 192); font-style: italic; font-family: 'Courier New';">EXTRA_TEXT</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">, </span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: 'Courier New';">"body"</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="background: rgb(192, 192, 192) none repeat scroll 0% 0%; font-size: 10.5pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); font-family: 'Courier New';">returnIt</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">.putExtra(Intent.</span><span style="font-size: 10.5pt; color: rgb(0, 0, 192); font-style: italic; font-family: 'Courier New';">EXTRA_SUBJECT</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">, </span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: 'Courier New';">"subject"</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="background: rgb(192, 192, 192) none repeat scroll 0% 0%; font-size: 10.5pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); font-family: 'Courier New';">returnIt</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">.setType(</span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: 'Courier New';">"message/rfc882"</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">Intent.</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-style: italic; font-family: 'Courier New';">createChooser</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">(</span><span style="background: rgb(192, 192, 192) none repeat scroll 0% 0%; font-size: 10.5pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); font-family: 'Courier New';">returnIt</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">, </span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: 'Courier New';">"Choose Email Client"</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: '宋体';">10<span style="font-family: 宋体;">,发短信</span></span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">Uri smsUri = Uri.</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-style: italic; font-family: 'Courier New';">parse</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">(</span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: 'Courier New';">"tel:100861"</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">returnIt = </span><span style="font-weight: bold; font-size: 10.5pt; color: rgb(127, 0, 85); font-family: 'Courier New';">new</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';"> Intent(Intent.</span><span style="font-size: 10.5pt; color: rgb(0, 0, 192); font-style: italic; font-family: 'Courier New';">ACTION_VIEW</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">, smsUri);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">returnIt.putExtra(</span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: 'Courier New';">"sms_body"</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">, </span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: 'Courier New';">"shenrenkui"</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">returnIt.setType(</span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: 'Courier New';">"vnd.android-dir/mms-sms"</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: '宋体';">11<span style="font-family: 宋体;">,直接发邮件</span></span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">Uri smsToUri = Uri.</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-style: italic; font-family: 'Courier New';">parse</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">(</span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: 'Courier New';">"smsto://100861"</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">returnIt = </span><span style="font-weight: bold; font-size: 10.5pt; color: rgb(127, 0, 85); font-family: 'Courier New';">new</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';"> Intent(Intent.</span><span style="font-size: 10.5pt; color: rgb(0, 0, 192); font-style: italic; font-family: 'Courier New';">ACTION_SENDTO</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">, smsToUri);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">returnIt.putExtra(</span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: 'Courier New';">"sms_body"</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">, </span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: 'Courier New';">"shenrenkui"</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: '宋体';">12<span style="font-family: 宋体;">,发彩信</span></span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">Ur</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: '宋体';">i </span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">mmsUri = Uri.</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-style: italic; font-family: 'Courier New';">parse</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">(</span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: 'Courier New';">"content://media/external/images/media/23"</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">returnIt = </span><span style="font-weight: bold; font-size: 10.5pt; color: rgb(127, 0, 85); font-family: 'Courier New';">new</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';"> Intent(Intent.</span><span style="font-size: 10.5pt; color: rgb(0, 0, 192); font-style: italic; font-family: 'Courier New';">ACTION_SEND</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">returnIt.putExtra(</span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: 'Courier New';">"sms_body"</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">, </span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: 'Courier New';">"shenrenkui"</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">returnIt.putExtra(Intent.</span><span style="font-size: 10.5pt; color: rgb(0, 0, 192); font-style: italic; font-family: 'Courier New';">EXTRA_STREAM</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">, mmsUri);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">returnIt.setType(</span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: 'Courier New';">"image/png"</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">);</span></p><br/><p class="p0" style="margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">用获取到的Intent直接调用startActivity(returnIt)就ok了。</span></p>
Selected Tags
Related Tags
Top Contributors
Groups interested in intent
-
#onlinepd
The intent of this list is t...
Items: 13 | Visits: 13
Created by: Mr. Schrage
-
Argentina
List of websites about Argen...
Items: 29 | Visits: 11
Created by: Beth O'Connor
-
dna_now
3-4 minutes videos to be pla...
Items: 57 | Visits: 13
Created by: Rana Chakrabarti
Diigo is about better ways to research, share and collaborate on information. Learn more »
Join Diigo
