mapview and cameraupdate in api v2

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-29 01:28:44

I solved the problem by adding on the "onCreate" the following lines:

 try {
     MapsInitializer.initialize(this);
 } catch (GooglePlayServicesNotAvailableException e) {
     e.printStackTrace();
 }

the reason is that the CameraUpdateFactory needs to be initilized (even if from documentation it seems that using mapview it shoud be automatically initialized)

I even replaced "public class MainActivity extends FragmentActivity" with "public class MainActivity extends Activity". But i think that this last thing it was not needed..

Paolo Mastrangelo

if i use:

try {
 MapsInitializer.initialize(this);
} catch (GooglePlayServicesNotAvailableException e) {
 e.printStackTrace();
}

The exception give me this error:

Unreachable catch block for GooglePlayServicesNotAvailableException.

This exception is never thrown from the try statement body".

I have use only:

MapsInitializer.initialize(this);

:)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!