Android app stopped unfortunately (Location) -


i struggling long fix users location in google maps activity. when runned once worked perfectly, marker spotted @ users location. ran again , app stops 2 errors in stack-trace.

here errors:

at com.doppler.stackingcoder.pechhulp.pechhulpactivity.onlocationchanged(pechhulpactivity.java:87) @ com.doppler.stackingcoder.pechhulp.pechhulpactivity.onmapready(pechhulpactivity.java:101) 

and here 2 methods have errors:

@override public void onlocationchanged(location location) {     latitude = location.getlatitude(); // line 87     longtitude = location.getlongitude(); }   @override public void onmapready(googlemap googlemap) {     mmap = googlemap;     mmap.movecamera(cameraupdatefactory.zoomto(10));     mmap.getuisettings().setrotategesturesenabled(false);      if (activitycompat.checkselfpermission(this, manifest.permission.access_fine_location) != packagemanager.permission_granted && activitycompat.checkselfpermission(this, manifest.permission.access_coarse_location) != packagemanager.permission_granted) {         return;     }     location location = locationmanager.getlastknownlocation(locationmanager.gps_provider);     onlocationchanged(location); // line 101      latlng myposition = new latlng(latitude, longtitude);      mmap.addmarker(new markeroptions().position(myposition)             .title("uw locatie:")             .snippet("dit uw locatie")             .icon(bitmapdescriptorfactory.fromresource(r.drawable.map_marker_mini))     );      mmap.movecamera(cameraupdatefactory.newlatlng(myposition));  } 


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -