问题
I want my user to enter an address. But I want the address to be confirmed with Google Map. So when the user clicks on a button to enter the address, I want to launch an Intent for Google Map where user can enter the address. But then I want the map to return the data to me. How do I do that? If I start my activity as
Uri searchUri = Uri.parse("geo:0,0?z=10&q=");
Intent mapIntent = new Intent(Intent.ACTION_VIEW,searchUri);
mapIntent.setPackage("com.google.android.apps.maps");
startActivityForResult(mapIntent,RESULT_CODE_LOCATION);
number one, will it do what I seek? Second: how do I implement onActivityResult
? I need the human readable address and the lat-long.
To be clear: I want the user to enter the address through Google Map and then have the address returned to my app.
回答1:
I figure it out. I have to use PlacePicker to accomplish what I seek. https://developers.google.com/places/android-api/placepicker
来源:https://stackoverflow.com/questions/34570445/how-to-start-google-map-for-result