android addmarker redirct zu falschen Position

stimmen
0

Wenn ich die Ausgabe von Log - lat einfügen und melden Sie sich lange in Google Maps leitet es automatisch Lage zu korrigieren , sondern animateCamera()zu falscher Stelle wird Umleitung in Google Android App abbildet. Bitte helfen Sie mit !

 public void onSearch(View view){
            Log.i(******************,in search function);
            EditText locationTf = (EditText)findViewById(R.id.editText);
            String location = locationTf.getText().toString();
            Log.i(Entered location:,location);
            if(location != null || location.equals()){
                Log.i(In if statement,all condition are satisfied);
                Geocoder geocoder = new Geocoder(this);
                try {
                    addresses = geocoder.getFromLocationName(location,1);
                    Log.i(in try block,addresses.toString());
                } catch (IOException e) {
                    e.printStackTrace();
                }

                Address address = addresses.get(0);
                Log.i(after try catch block,address.toString());
                LatLng searchLatLng = new LatLng(address.getLatitude(),address.getLatitude());
                double logLat = address.getLatitude() ;
                double logLon = address.getLongitude() ;
                Log.i(********************,&&&&&&&&&&&&&&&&&&&&&&&&);
                Log.i(Double.toString(logLat),Double.toString(logLon));

                mMap.addMarker(new MarkerOptions().position(searchLatLng).title(Results));
                mMap.animateCamera(CameraUpdateFactory.newLatLng(searchLatLng));
               // mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(searchLatLng, 10));
            }
            else {

            }

        }
Veröffentlicht am 20/11/2017 um 17:04
quelle vom benutzer
In anderen Sprachen...                            


1 antworten

stimmen
0

Sie sind vorbei 2 Breitengrade.

LatLng(address.getLatitude(),address.getLatitude());

Anstatt von

LatLng(address.getLatitude(),address.getLongitude());
Beantwortet am 21/11/2017 um 05:39
quelle vom benutzer

Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more