Custom place picker using google map(Image sample)
How to
To get a Git project into your build:
Step 1. Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.AkashG58:AKPlacePicker:1.0.0'
}
Check the sample project for a full working example.
Intent intent = new PlacePicker.IntentBuilder()
.setGoogleMapApiKey("Your API Key")
.setLatLong(18.520430, 73.856743)
.setMapZoom(19.0f)
.setAddressRequired(true)
.setPrimaryTextColor(R.color.black)
.build(this);
startActivityForResult(intent, Constants.PLACE_PICKER_REQUEST);
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == Constants.PLACE_PICKER_REQUEST) {
if (resultCode == Activity.RESULT_OK && data != null) {
AddressData addressData = data.getParcelableExtra(Constants.ADDRESS_INTENT);
// your code
}
}
}
AKPlacePicker is released under the MIT license. See LICENSE for details.