如何判断一个街景启动街景意图之前存在 [英] How to tell if a Streetview exists before launching Streetview intent

查看:142
本文介绍了如何判断一个街景启动街景意图之前存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

启动一个街景意图为一个位置并不保证一个街景存在该位置。如果街景不存在时,用户只看到黑屏该旋转。有没有一种方法以编程方式检查是否启动街景意图之前存在?

Launching a Streetview intent for a location doesn't guarantee that a Streetview exists for that location. If the Streetview doesn't exist, the user just sees a black screen that spins. Is there a way to programmatically check if it exists before launching the Streetview intent?

推荐答案

使用<一个href="http://android-developers.blogspot.com/2009/01/can-i-use-this-intent.html"><$c$c>PackageManager queryIntentActivities() 您的意图。如果你获得了0匹配的活动清单,你什么都不知道设备将处理您的请求。

Use PackageManager and queryIntentActivities() with your Intent. If you get back a list of 0 matching activities, you know nothing on the device will handle your request.

这篇关于如何判断一个街景启动街景意图之前存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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