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);

results matching ""

    No results matching ""