I have followed a 24 hours textbook and created an Android app that is supposed to launch Google maps and navigate to a specific location based on latitude and longitude coordinates hard coded into the app. However, when I launch the app and run the code it opens Google maps or Google Earth and always defaults to my current location. How do I prevent it from doing this?
I am trying to get my app to go to a specific latitude and longitude, but when it launches Google Maps or Google Earth it always defaults to my current location. Java Code is as follows:
Button mapButton = (Button) findViewById(R.id.button2);
mapButton.setOnClickListener(new View.OnClickListener() {
@override
public void onClick(View view) {
String geoURI = "geo:37.422,-122.0847z=23";
Uri geo = Uri.parse(geoURI);
Intent mapIntent = new Intent(Intent.ACTION_VIEW, geo);
if (mapIntent.resolveActivity(getPackageManager()) != null) {
startActivity(mapIntent);
How do I get it to override the default location and go to the coordinates I have hard coded above?