Finding Location on Google Map

后端 未结 3 889
死守一世寂寞
死守一世寂寞 2021-01-28 13:43

i am trying to find my location on Google Map. My code is here. I have run my app in my telephone but it\'s unfortunately stopped. Any ideas about what can be the problem ? Than

3条回答
  •  春和景丽
    2021-01-28 14:32

    On this line:

    map.addMarker(new MarkerOptions().position(loc).title("Istanbul"));
    

    loc is null

    Also, you should not call onLocationChanged() directly, it is a callback. The whole process is event driven, i.e. when the GPS or network gives you a location that method triggers.

提交回复
热议问题