0

I am using latest Place Picker control which Android provides. It's really easy to use.

Now, the questions are:

  1. Can I restrict the searching area to India only?

  2. Can I change the default marker icon which resides in the PlacePicker control?

NOTE: I am not using any MapView or Fragment for displaying any map. I am using PlacePicker and not using GoogleMap.

BSMP
  • 4,596
  • 8
  • 33
  • 44
ZaptechDev Kumar
  • 164
  • 1
  • 14

1 Answers1

0
   public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == PLACE_PICKER_REQUEST) {
        if (resultCode == RESULT_OK) {
            Place place = PlacePicker.getPlace(mActivity, data);
            Log.d(TAG, "onActivityResult: " + place.getAddress());
            if (place.getAddress() != null) {
                // ask for geolocation data
                Geocoder gcd = new Geocoder(mActivity, Locale.getDefault());

                try {
                    addresses = gcd.getFromLocation(place.getLatLng().latitude, place.getLatLng().longitude, 1);
                } catch (IOException e) {
                    e.printStackTrace();
                }


                if (addresses.size() > 0) {
                    if (addresses.get(0).getCountryCode().equalsIgnoreCase(getString(R.string.india))) {
                        //write the code here
                    } else {
                        Toast.makeText(mActivity, "Invalid places", Toast.LENGTH_SHORT).show();
                    }
                }
            }
        }
    }
}
tom030888
  • 381
  • 2
  • 5
  • 14