<?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: Re-center Offline Map in ArcGIS Runtime SDK for Android Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/re-center-offline-map/m-p/1020864#M5416</link>
    <description>&lt;P&gt;Hi JohnMeah,&lt;/P&gt;&lt;P&gt;You can get the map's &lt;STRONG&gt;&lt;EM&gt;initialViewPoint (map[0].initialViewpoint)&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp; which you can use to set it on one of&amp;nbsp;&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;`MapView.setViewPointAsync` &lt;/STRONG&gt;&lt;/EM&gt;methods every time you load a new map from MobileMapPackage.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Rama&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 28 Jan 2021 03:09:09 GMT</pubDate>
    <dc:creator>RamaChintapalli</dc:creator>
    <dc:date>2021-01-28T03:09:09Z</dc:date>
    <item>
      <title>Re-center Offline Map</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/re-center-offline-map/m-p/1019686#M5414</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; I have developed an offline maps module for Android that has a bug where the user location is focused on instead of the offline map. &amp;nbsp;What happens is that if the user moves the map to a location other than where the user is focused and saves the map for offline use then when the the offline map is displayed the user's location takes precedent and the offline map is shown offscreen, the user would have to swipe over to the offline map. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; I have a method openOfflineMap that does the work of opening the saved map. &amp;nbsp;Is there a way to always ensure that the offline map is displayed even if there is a user location? &amp;nbsp;I have tried saving the offline maps lat/lng without luck. &amp;nbsp;Any help is greatly appreciated.&lt;/P&gt;&lt;P&gt;Here is the code that opens the map:&lt;/P&gt;&lt;LI-CODE lang="kotlin"&gt;    private fun openOfflineMap() {
        val offlineMapPackage = MobileMapPackage(offlineMapDirectoryPath)
        offlineMapPackage.loadAsync()
        offlineMapPackage.addDoneLoadingListener {
            if (offlineMapPackage.maps.size == 0) {
                mapNotDownloadedMsg!!.visibility = View.VISIBLE
                progressBar!!.visibility = View.GONE
            } else {
                mapView!!.map = offlineMapPackage.maps[0]
                callout = mapView!!.callout
                progressBar!!.visibility = View.GONE
                //                    downloadMapIcon.setVisibility(View.GONE);
                mapView!!.visibility = View.VISIBLE
                mapView!!.onTouchListener = object : DefaultMapViewOnTouchListener(context, mapView) {
                    override fun onSingleTapConfirmed(e: MotionEvent): Boolean {
                        if (callout.isShowing()) {
                            callout.dismiss()
                        }
                        val screenPoint = Point(Math.round(e.x), Math.round(e.y))
                        // identifyResult(screenPoint);
                        identifyandDisplayResults(screenPoint)
                        return true
                    }
                }

                /*
                val savedMapLat : Double? = sharedPreferencesPseg.getString("SAVEDMAPLAT").toDouble()
                val savedMapLng : Double? = sharedPreferencesPseg.getString("SAVEDMAPLNG").toDouble()
                CenterToJobLocation(savedMapLat, savedMapLng)
                 */
            }
        }
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2021 16:54:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/re-center-offline-map/m-p/1019686#M5414</guid>
      <dc:creator>JohnMeah</dc:creator>
      <dc:date>2021-01-25T16:54:31Z</dc:date>
    </item>
    <item>
      <title>Re: Re-center Offline Map</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/re-center-offline-map/m-p/1020864#M5416</link>
      <description>&lt;P&gt;Hi JohnMeah,&lt;/P&gt;&lt;P&gt;You can get the map's &lt;STRONG&gt;&lt;EM&gt;initialViewPoint (map[0].initialViewpoint)&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp; which you can use to set it on one of&amp;nbsp;&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;`MapView.setViewPointAsync` &lt;/STRONG&gt;&lt;/EM&gt;methods every time you load a new map from MobileMapPackage.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Rama&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2021 03:09:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/re-center-offline-map/m-p/1020864#M5416</guid>
      <dc:creator>RamaChintapalli</dc:creator>
      <dc:date>2021-01-28T03:09:09Z</dc:date>
    </item>
    <item>
      <title>Re: Re-center Offline Map</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/re-center-offline-map/m-p/1021234#M5418</link>
      <description>&lt;P&gt;Thanks, this works some of the time. &amp;nbsp;I found that the initialViewPoint can be null. &amp;nbsp;I'm using the code below which is working.&lt;/P&gt;&lt;LI-CODE lang="kotlin"&gt;                //Center to the map
                if (mapView!!.map.initialViewpoint != null) {
                    Handler(Looper.getMainLooper()).post {
                        mapView!!.setViewpointAsync(mapView!!.map.initialViewpoint)
                        println("initial viewpoint works")
                    }
                } else if (mapView!!.getCurrentViewpoint(Viewpoint.Type.BOUNDING_GEOMETRY) != null) {
                    Handler(Looper.getMainLooper()).post {
                        mapView!!.setViewpointAsync(mapView!!.getCurrentViewpoint(Viewpoint.Type.BOUNDING_GEOMETRY))
                        println("current viewpoint works")
                    }

                }&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 28 Jan 2021 20:19:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/re-center-offline-map/m-p/1021234#M5418</guid>
      <dc:creator>JohnMeah</dc:creator>
      <dc:date>2021-01-28T20:19:13Z</dc:date>
    </item>
  </channel>
</rss>

