ACTION_SEND意图机器人 [英] ACTION_SEND intent android

查看:89
本文介绍了ACTION_SEND意图机器人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用ACTION_SEND意图,我想通过传递选择器,只是直接进入应用程序,我希望有一个URL来传递给特定的应用程序,但它似乎并没有采取URL,除非我使用的选择器..

I am trying to pass a url to a specific app using the ACTION_SEND intent, I want to by pass the chooser and just go straight to the app i desire but it doesn't seem to take the url unless i use the chooser..

    private void shareIt(){

                Intent pC = new Intent(Intent.ACTION_SEND);
                pC.setType("text/plain");
                pC.putExtra(Intent.EXTRA_TEXT, "http://www.bob.com");
                pC.setType("text/plain");
                pC.setClassName("com.sec.print.mobileprint","com.sec.print.mobileprint.UI.WebPrint");
                //startActivity(pC);

                startActivity(Intent.createChooser(pC,"Share jon"));

            }

如果我注释掉最后一行,并在该行发表评论,回来后才它..它打开的应用程序,我想绕过选择器,但应用程序打开谷歌bob.com ..不是,如果我离开它的。 。它带来了选择器,我应该选择它去bob.com ..的应用程序,我怎样才能得到它去bob.com而绕过选择器?

if i comment out the last line and comment back in the line before it.. it opens the app i want bypassing the chooser, but the app opens to google instead of bob.com.. if i leave it as is.. it brings up the chooser and should i choose the app it goes to bob.com .. how can i get it to go to bob.com while bypassing the chooser?

推荐答案

你确定你需要传递通过EXTRA_TEXT的网址,而不是由 pC.setData(Uri.parse(HTTP:// www.bob.com);

Are you sure you need to pass the URL via EXTRA_TEXT and not by pC.setData(Uri.parse("http://www.bob.com");?

这篇关于ACTION_SEND意图机器人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆