温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Thinking in Google Doc-不同的Apps之间的交互

发布时间:2020-07-16 18:08:08 来源:网络 阅读:259 作者:屠夫章哥 栏目:移动开发

1.隐式意图

   怎么传值我就不细说了,说些一般人不知道的吧。

   1)Verify There is an App to Receive the Intent(判断是否有App响应了意图)

    you should always include a verification step before invoking an intent.

    Caution: If you invoke an intent and there is no app available on the device that     can handle the intent, your app will crash.(没有应用处理意图,应用就会挂掉。)

     因为你不能保证每个手机上都有你需要的应用!

PackageManager packageManager = getPackageManager();
List activities = packageManager.queryIntentActivities(intent,
       
PackageManager.MATCH_DEFAULT_ONLY);
boolean isIntentSafe = activities.size() > 0;

    If isIntentSafe is true, then at least one app will respond to the intent. If it is

   false, then there aren't any apps to handle the intent.


   2)  

 

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI