简体   繁体   English

getStreetViewPanorama()在Android中始终返回null

[英]getStreetViewPanorama() returning null always in android

While am trying to get Google Street View in my app am always getting getStreetViewPanorama() is null. 在尝试在我的应用中获取Google Street View时,始终会获取getStreetViewPanorama()为null。 Here in this url https://developers.google.com/maps/documentation/business/mobile/android/reference/com/google/android/m4b/maps/SupportStreetViewPanoramaFragment they clearly telling getStreetViewPanorama() may return null depends upon Google Play services APK 在此网址https://developers.google.com/maps/documentation/business/mobile/android/reference/com/google/android/m4b/maps/SupportStreetViewPanoramaFragment中,他们明确告诉getStreetViewPanorama()可能返回null取决于Google Play服务APK

However you cannot be guaranteed when it will be ready because this depends on the availability of the Google Play services APK. 但是,您无法保证它何时准​​备就绪,因为这取决于Google Play服务APK的可用性。 If a StreetViewPanorama is not available, getStreetViewPanorama() will return null. 如果StreetViewPanorama不可用,则getStreetViewPanorama()将返回null。

But still I can't understand why it is not available with my latest Nexus 5 mobile. 但我仍然不明白为什么最新的Nexus 5移动版无法使用它。 I hope it have latest Google Play services APK 我希望它具有最新的Google Play服务APK

I hope it have latest Google Play services APK 我希望它具有最新的Google Play服务APK

Better that just hoping for it: isGooglePlayServicesAvailable 更好的是只是希望它: isGooglePlayServicesAvailable

From android docs : Returns Null if the view of the fragment is not yet ready. 来自android docs :如果片段视图尚未准备好,则返回Null。 This can happen if the fragment lifecyle have not gone through onCreateView(LayoutInflater, ViewGroup, Bundle) yet. 如果片段生命周期尚未通过onCreateView(LayoutInflater,ViewGroup,Bundle),则会发生这种情况。 This can also happen if Google Play services is not available. 如果Google Play服务不可用,也会发生这种情况。 If Google Play services becomes available afterwards and the fragment have gone through onCreateView(LayoutInflater, ViewGroup, Bundle), calling this method again will initialize and return the StreetViewPanorama. 如果之后可以使用Google Play服务,并且该片段已通过onCreateView(LayoutInflater,ViewGroup,Bundle),则再次调用此方法将初始化并返回StreetViewPanorama。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM