码迷,mamicode.com
首页 > 移动开发 > 详细

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

时间:2015-11-23 06:34:30      阅读:226      评论:0      收藏:0      [点我收藏+]

标签:android思考

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)  

 

本文出自 “行意天下” 博客,请务必保留此出处http://4259297.blog.51cto.com/4249297/1715709

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

标签:android思考

原文地址:http://4259297.blog.51cto.com/4249297/1715709

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!