See Route Element Details

Android v4

In this tutorial we will request a route and list the route parts. A MapsIndoors route is made of one or more legs, each containing one or more steps.

Start by creating a BaseAdapter implementation with a MPRoute property, and include all the required functions.

class RouteListAdapter(private val context: Context) : BaseAdapter() {
    private var route: MPRoute? = null
 
    override fun getCount(): Int {
        TODO("Not yet implemented")
    }

    override fun getItem(position: Int): Any {
        TODO("Not yet implemented")
    }

    override fun getItemId(position: Int): Long {
        TODO("Not yet implemented")
    }

    override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
        TODO("Not yet implemented")
    }
}

Inside the init section, setup a directions service, call the directions service and save the route result to your route property

Override the getCount function to return the number of steps

Override the getView function to create your views that should be displayed in the list

Override getItem and getItemId to let click events work corretly

Now you can add the adapter to your ListView and show the route elements

Last updated

Was this helpful?