<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Routes won't render to the screen in ArcGIS Runtime SDK for Android Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/routes-won-t-render-to-the-screen/m-p/1164220#M5732</link>
    <description>&lt;P&gt;Not sure if you'll receive this as this is an old post, but I'm having the exact same issue rn. If you have found a solution to this can you please share with me, thanks!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Apr 2022 00:56:44 GMT</pubDate>
    <dc:creator>Jotded</dc:creator>
    <dc:date>2022-04-14T00:56:44Z</dc:date>
    <item>
      <title>Routes won't render to the screen</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/routes-won-t-render-to-the-screen/m-p/1028430#M5434</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I built a React Native component in Kotlin. I used a SimpleViewManager type of class to expose this component to React Native and I use it to render an esri map. The problem is I cannot use RouteTask properly for creating a route between 2 points on the map and I do not know where the problem is.&lt;/P&gt;&lt;P&gt;This is the function that I use:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="kotlin"&gt;private fun findRoute() {
        val routeTask = RouteTask(
                context,
                "https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World"
        )

        val routeParametersFuture = routeTask.createDefaultParametersAsync()
        routeParametersFuture.addDoneListener {
            try {
                val routeParameters = routeParametersFuture.get().apply {
                    isReturnDirections = true
                    setStops(routeStops)
                }

                // get the route and display it
                val routeResultFuture = routeTask.solveRouteAsync(routeParameters)
                routeResultFuture.addDoneListener {
                        val result = routeResultFuture.get()
                        val routes = result.routes
                        if (routes.isNotEmpty()) {
                            val route = routes[0]

                            val shape = route.routeGeometry
                            val routeGraphic = Graphic(
                                    shape,
                                    SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.BLUE, 2f)
                            )
                            graphicsOverlay.graphics.add(routeGraphic)
                        }
                }
            } catch (e: Exception) {
                val error = "Error creating default route parameters: " + e.message
                Toast.makeText(context, error, Toast.LENGTH_LONG).show()
                Log.e(ArcGISViewMaps::class.simpleName, error)
            }
        }
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and I use it in createViewInstance of the SimpleViewManager class that I mentioned before. See below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="kotlin"&gt;override fun createViewInstance(reactContext: ThemedReactContext): MapView {
        val view = MapView(reactContext)
        ArcGISRuntimeEnvironment.setApiKey("myAPI")
        val map = ArcGISMap(BasemapStyle.ARCGIS_STREETS)
        view.map = map
        view.setViewpoint(Viewpoint(latitudeDefault, longitudeDefault, 72000.0))
        view.graphicsOverlays.add(graphicsOverlay)
        val pointDisplay1 = Point(longitudeDefault, latitudeDefault, SpatialReferences.getWgs84())
        addStop(Stop(pointDisplay1))
        val pointDisplay2 = Point(-6.2603,53.37,SpatialReferences.getWgs84())
        addStop(Stop(pointDisplay2))
        findRoute()
        return view
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As a context for the RouteTask I use reactContext. I am passing that context from the package manager where I call this class to be exposed to React Native.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Finally, it shows an error that I catch and expose in React Native, the error says:&amp;nbsp;&lt;/P&gt;&lt;P&gt;"Error creating default route parameters: com.esri.arcgisruntime.ArcGISRuntimeException: Invalid call.: Object failed to load, unable to execute task."&lt;/P&gt;&lt;P&gt;If you have any ideas regarding this issue, please do let me know as soon as possible.&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 09:12:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/routes-won-t-render-to-the-screen/m-p/1028430#M5434</guid>
      <dc:creator>OctavianSirbu</dc:creator>
      <dc:date>2021-02-19T09:12:20Z</dc:date>
    </item>
    <item>
      <title>Re: Routes won't render to the screen</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/routes-won-t-render-to-the-screen/m-p/1032319#M5442</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Does the `reactContext` provides the application or activity context?&lt;/P&gt;&lt;P&gt;Also were you able to perform route task operations outside of React Native setup, like running this tutorial.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/android/route-and-directions/tutorials/find-a-route-and-directions/" target="_blank"&gt;https://developers.arcgis.com/android/route-and-directions/tutorials/find-a-route-and-directions/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Rama&lt;/P&gt;</description>
      <pubDate>Wed, 03 Mar 2021 06:48:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/routes-won-t-render-to-the-screen/m-p/1032319#M5442</guid>
      <dc:creator>RamaChintapalli</dc:creator>
      <dc:date>2021-03-03T06:48:37Z</dc:date>
    </item>
    <item>
      <title>Re: Routes won't render to the screen</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/routes-won-t-render-to-the-screen/m-p/1164220#M5732</link>
      <description>&lt;P&gt;Not sure if you'll receive this as this is an old post, but I'm having the exact same issue rn. If you have found a solution to this can you please share with me, thanks!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2022 00:56:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/routes-won-t-render-to-the-screen/m-p/1164220#M5732</guid>
      <dc:creator>Jotded</dc:creator>
      <dc:date>2022-04-14T00:56:44Z</dc:date>
    </item>
  </channel>
</rss>

