Skip to main content

Vincent Tsao's Library tagged intent   View Popular, Search in Google

Dec
13
2010

  • 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 a VIEW intent with a data URI like vnd.youtube:VIDEO_ID will 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)...
Nov
19
2010

  • 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);
Jul
9
2010

  • 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)...
May
21
2009

  • <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&nbsp;</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';">&nbsp;=&nbsp;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&nbsp;=&nbsp;</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';">&nbsp;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';">,&nbsp;</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&nbsp;mapUri&nbsp;=&nbsp;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&nbsp;=&nbsp;</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';">&nbsp;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';">,&nbsp;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&nbsp;telUri&nbsp;=&nbsp;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&nbsp;=&nbsp;</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';">&nbsp;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';">,&nbsp;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&nbsp;callUri&nbsp;=&nbsp;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&nbsp;=&nbsp;</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';">&nbsp;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';">,&nbsp;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&nbsp;uninstallUri&nbsp;=&nbsp;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';">,&nbsp;</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';">,&nbsp;</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&nbsp;=&nbsp;</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';">&nbsp;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';">,&nbsp;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&nbsp;installUri&nbsp;=&nbsp;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';">,&nbsp;</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';">,&nbsp;</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&nbsp;=&nbsp;</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';">&nbsp;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';">,&nbsp;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&nbsp;playUri&nbsp;=&nbsp;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&nbsp;=&nbsp;</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';">&nbsp;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';">,&nbsp;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&nbsp;emailUri&nbsp;=&nbsp;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&nbsp;=&nbsp;</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';">&nbsp;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';">,&nbsp;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';">&nbsp;=&nbsp;</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';">&nbsp;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[]&nbsp;tos&nbsp;=&nbsp;{&nbsp;</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';">&nbsp;};</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[]&nbsp;ccs&nbsp;=&nbsp;{&nbsp;</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';">&nbsp;};</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';">,&nbsp;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';">,&nbsp;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';">,&nbsp;</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';">,&nbsp;</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';">,&nbsp;</span><span style="font-size: 10.5pt; color: rgb(42, 0, 255); font-family: 'Courier New';">"Choose&nbsp;Email&nbsp;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&nbsp;smsUri&nbsp;=&nbsp;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&nbsp;=&nbsp;</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';">&nbsp;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';">,&nbsp;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';">,&nbsp;</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&nbsp;smsToUri&nbsp;=&nbsp;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&nbsp;=&nbsp;</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';">&nbsp;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';">,&nbsp;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';">,&nbsp;</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&nbsp;</span><span style="font-size: 10.5pt; color: rgb(0, 0, 0); font-family: 'Courier New';">mmsUri&nbsp;=&nbsp;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&nbsp;=&nbsp;</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';">&nbsp;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';">,&nbsp;</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';">,&nbsp;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>
1 - 17 of 17
Showing 20 items per page

Diigo is about better ways to research, share and collaborate on information. Learn more »

Join Diigo
Move to top