Examples of use cited in https://developers.google.com/maps/documentation/android-api/intents
Find nearby restaurants:
Uri gmmIntentUri = Uri.parse("geo:0,0?q=restaurants");
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);
Search for restaurants in São Paulo Capital (based on a specific geo-location):
Uri gmmIntentUri = Uri.parse("geo:-23.564175,-46.6617916?q=restaurants");
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);
Locate a described address:
Uri gmmIntentUri = Uri.parse("geo:0,0?q=Avenida São João - República, São Paulo - SP");
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);
With the TextView
should look like this:
TextView searchTextField = (TextView) this.findViewById(R.id.searchTextField);
Uri gmmIntentUri = Uri.parse("geo:0,0?q=" + searchTextField.getText().toString());
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);
Hi William, thank you so much! Already gave me the code of Textview. It worked that is a beauty!
– Elaine Breda Schwaner