Place Selector Widget

Place Selector widget enables the user to create a Place object with one of either user's recently selected places, his current location, place suggestions, and pinnable locations. This guide will cover how to enable Place Selector View.

Where would it be useful?

You can use the Place Selector widget to enable user to pick a place of his/her choice. One use-case is to build a live location sharing messaging app using HyperTrack APIs.


  1. Reduces development time
  2. Free
  3. Includes the pinnable locations on a map
  4. Provides reverse-geocoded place suggestions

Enabling Place Selector widget

Add HyperTrackMapFragment in activity's layout file

Place Selector View is embeded in HyperTrackMapFragment. You need to add HyperTrackMapFragment snippet in your activity layout file.

// Add the fragment below in your activity's layout file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=""
        tools:layout="@layout/fragment_map_new" />

Get selected places

Enable view by creating a class extending HyperTrackMapAdapter. This view is DISABLED by default.

//Extend HyperTrackMapAdapter for customizing UI elements in the map view
public class MyMapAdapter extends HyperTrackMapAdapter {
    public boolean showPlaceSelectorView() {
        return true;

To get a selected Place object, create an object of class MapFragmentCallback from SDK and overide a method onExpectedPlaceSelected(Place expectedPlace).

private MapFragmentCallback mapFragmentCallback = new MapFragmentCallback() {
    public void onExpectedPlaceSelected(Place expectedPlace) {
        if (expectedPlace != null) {
            // Use this place

Intialize HyperTrackMapFragment and start Activity

Inside onCreate method of your aactivity containing the map view and set HTMapFragmentCallback to receive user's selected place object.

// Initialize Map Fragment added in MyMapActivity Layout
HyperTrackMapFragment htMapFragment = 
(HyperTrackMapFragment) getSupportFragmentManager().findFragmentById(;
adapter = new MyMapAdapter(this, getToolbar());

Start your activity containing HyperTrackMapFragment snippet and you can receive user's selected place object in MapFragmentCallback method onExpectedPlaceSelected(Place expectedPlace)

Intent intent = new Intent(this, MyMapActivity.class);

Open Place Selector View (Optional)

There are two ways through which Place Selector View will open either by tapping on address info view or by calling a method HyperTrackMapFragment.openPlaceSelectorView.

HyperTrackMapFragment htmapFragment = 
(HyperTrackMapFragment) getSupportFragmentManager().findFragmentById(;

Customization Method

You need to implement this methods in your class extending HyperTrackMapAdapter for customizations.

boolean showLocationDoneButton

Default behaviour of this method is to show DONE button to confirm the choosen location by dragging a map. Implement this method to overide the default behaviour.

This button will only visible when user tapped on Choose on Map item from suggestion list.

If you hide this button then you can use HyperTrackMapFragment.doneLocationChosen method to choose a selected location.

HyperTrackMapFragment htmapFragment = (HyperTrackMapFragment) getSupportFragmentManager().findFragmentById(;
public boolean showLocationDoneButton() {
    return true;

Callbacks Method

You need to override this methods in your class extending MapFragmentCallback for receiving callbacks.

void onPlaceSelecterViewShown

Override this method to get a callback when Place Selector View will show.

public void onPlaceSelecterViewShown() {
    //Handle onPlaceSelecterViewShown API callback here
void onPlaceSelectorViewClosed

Override this method to get a callback when Place Selector View will close.

public void onPlaceSelectorViewClosed() {
    //Handle onPlaceSelectorViewClosed API callback here
void onChooseOnMapSelected

Override this method to get a callback when User selects "Choose on Map" from Place Picker widget suggestion list.

public void onChooseOnMapSelected() {
    //Handle onChooseOnMapSelected API callback here
void onBackButtonIconPressed

Override this method to get a callback when user taps on back icon button.

public void onBackButtonIconPressed() {
    //Handle onBackButtonIconPressed API callback here

results matching ""

    No results matching ""