raagull sakthivel
raagull sakthivel

Reputation: 21

How to add custom markers in PlaceListMapTemplate in kotlin in android auto

im trying to add custom marker in this template but I couldn't can someone help me with this

override fun onGetTemplate(): Template {


        val itemListBuilder = ItemList.Builder().setNoItemsMessage("No places to show")
        ItemRepository.getItems().forEach { itemListBuilder.addItem(itemRow(it)) }

        val builder = PlaceListMapTemplate.Builder()
        .setItemList(itemListBuilder.build())

        if (hasLocationPermission) {
            builder.setCurrentLocationEnabled(true)
        }

        return builder.build()
    }

Upvotes: 1

Views: 41

Answers (1)

Ben Sagmoe
Ben Sagmoe

Reputation: 1447

What does your itemRow method look like? To customize the marker, you need to associate a Place that has a PlaceMarker with each Row using the Row.Builder::setMetadata method. PlaceListMapTemplate::setItemList has more details.

Upvotes: 0

Related Questions