diff --git a/app/src/main/java/org/ntlab/amaryllis/client/fragment/MapsFragment.java b/app/src/main/java/org/ntlab/amaryllis/client/fragment/MapsFragment.java index 35cacef..c55f77b 100644 --- a/app/src/main/java/org/ntlab/amaryllis/client/fragment/MapsFragment.java +++ b/app/src/main/java/org/ntlab/amaryllis/client/fragment/MapsFragment.java @@ -124,9 +124,6 @@ // String longitude = amaryllis.getLongitude(); // double latitude1 = Double.parseDouble(latitude); // double longitude1 = Double.parseDouble(longitude); - - - MapsFragment.this.googlemap = googleMap; } @@ -193,10 +190,12 @@ @Override public void onLocationChanged(Location location) { LatLng current = new LatLng(location.getLatitude(), location.getLongitude()); - if(googlemap != null && count == 0) { - MapsFragment.this.googlemap.moveCamera(CameraUpdateFactory.newLatLngZoom(current, 120)); - count++; - }else{ + if(googlemap != null) { + if(count == 0) { + MapsFragment.this.googlemap.moveCamera(CameraUpdateFactory.newLatLngZoom(current, 120)); + count++; + } + else{ MapsFragment.this.googlemap.addMarker(new MarkerOptions().position(current).title("Marker in Sydney")); MapsFragment.this.googlemap.moveCamera(CameraUpdateFactory.newLatLng(current)); Projection p = googlemap.getProjection(); @@ -222,7 +221,7 @@ public void onFailure(Call> call, Throwable t) { } }); - } + }} }