So I got the latitude and longitude and successfully saved it on firebase, and now I was able to retrieve it and paste their values on a TextView.
I am planning to get the string value from the TextView and convert it to double and use that as a latitude and longitude to show a location on a map. I followed the format for converting string value to double value and it still wont work.
This is my code:
@Override public void onMapReady(GoogleMap googleMap) { mMap = googleMap;
String latitude = textViewLatt.getText().toString();
String longitude = textViewLong.getText().toString();
//Double latitude = Double.valueOf(textViewLatt.getText().toString());
//Double longitude = Double.valueOf(textViewLong.getText().toString());
double latt = Double.parseDouble(latitude);
double longi= Double.parseDouble(longitude);
//double latt = Double.valueOf(latitude);
//double longi = Double.valueOf(longitude);
// Add a marker in Sydney and move the camera
LatLng sydney = new LatLng(latt, longi);
mMap.addMarker(new MarkerOptions()
.position(sydney)
.title("Marker"));
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
and these are the errors I got from debugging, I tried to search the problem and I couldnt find any solutions. Any help will be great.
Update: I found the problem, it seems like its getting the value even before I change the textview's value into numbers. thus it was trying to convert "latitude"(the previous value of the textview) to a double and instead of the coordinates.
Thank you for your suggestions guys!