Google Map Android api V2 中使用MapView遇到CameraUpdateFactory is not initialized!的解决办法
来源:互联网 发布:无网络传奇单机破解版 编辑:程序博客网 时间:2024/05/02 03:10
先说一下 Map V2 API Key 的问题吧:
在打包APP时需要自己生成一个XXX.keystore 用这个密室库生成的SHA1去申请的key 作为AndroidManifest.xml 中的Key使用。
(有时候用debug.keystore生成的Key也可以,不知原因)
进入正题:
根据 https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/CameraUpdateFactory?hl=zh-CN 描述,
CameraUpdateFactory
A class containing methods for creating CameraUpdate
objects that change a map's camera. To modify the map's camera, call animateCamera(CameraUpdate)
, animateCamera(CameraUpdate, GoogleMap.CancelableCallback)
or moveCamera(CameraUpdate)
, using a CameraUpdate
object created with this class.
For example, to zoom in on a map, you can use the following code:
GoogleMap map = ...; map.animateCamera(CameraUpdateFactory.zoomIn());
Prior to using any methods from this class, you must do one of the following to ensure that this class is initialized:
- Wait for a
GoogleMap
to become available from aMapFragment
orMapView
that you have added to your application. You can verify that theGoogleMap
is available by calling thegetMap()
method and checking that the returned object is not null. - Call
initialize(Context)
. As long as a com.google.android.gms.common.GooglePlayServicesNotAvailableException GooglePlayServicesNotAvailableException isn't thrown, this class will be correctly initialized.
1.GoogleMap对象不为空
2.MapsInitializer.initialize(Context) 进行初始化
因此排除GoogleMap对象为空,只需在CameraUpdateFactory 之前调用MapsInitializer.initialize(Context) 即可进行初始化。
- Google Map Android api V2 中使用MapView遇到CameraUpdateFactory is not initialized!的解决办法
- Google Map Android api V2 中使用MapView遇到CameraUpdateFactory is not initialized!的解决办法
- Android google map api v2 使用关键
- Google Map Android API V2使用总结
- Android 使用Google Map API v2
- Google Map API使用中出现的“google未定义”解决办法
- Google Map Android API v2
- 使用google map v2 api
- 使用Google Map API v2
- 使用Google Map API v2
- Android应用中使用google map时,申请mapview的apiKey,不用翻墙
- android中使用Baidu Map遇到的问题之:移动Mapview上的放大缩小控件
- android手机端使用google map api V2
- Android学习笔记(五七):使用Google Map API v2
- Android学习笔记(环境配置):使用Google Map API v2
- Android学习笔记(五七):使用Google Map API v2
- Google Maps Android API V2的使用
- Android上调用google map api v2
- 临时表
- 十道海量数据处理面试题与十个方法大总结
- 转载_ARM-Linux内核驱动加载过程思路
- c++学习笔记(1)——环境搭建、经典教程推荐及 Visual Studio 2005/2008中如何编译和运行C++程序
- mark
- Google Map Android api V2 中使用MapView遇到CameraUpdateFactory is not initialized!的解决办法
- 设置JAVA_OPTS
- LeetCode-Pascal's Triangle
- 题目1444:More is better
- discuz通过调用函数实现同步登录与退出
- [leetcode] Merge Sorted Array
- USB 3.0 开发要点
- 利用SQOOP将数据从数据库导入到HDFS
- Android增加键值(一)