<?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 No MapView.removeOnTouchListener? Causes memory leak.  in ArcGIS Runtime SDK for Android Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/no-mapview-removeontouchlistener-causes-memory/m-p/757051#M5338</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How are we supposed to remove the onTouchListener when our Activity gets destroyed?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is a setOnTouchlistener but no remove.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Setting it to null won't work - you will throw an exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is important because you are holding on to the reference and our activity can't be garbage collected, causing a huge memory leak.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have used removeListeners for Scale and NavigationChanged.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only thing I can think of now is to create a DummyonTouchListener that does nothing, and set it in onDestroy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 12 Nov 2018 15:29:49 GMT</pubDate>
    <dc:creator>NathanMellor</dc:creator>
    <dc:date>2018-11-12T15:29:49Z</dc:date>
    <item>
      <title>No MapView.removeOnTouchListener? Causes memory leak.</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/no-mapview-removeontouchlistener-causes-memory/m-p/757051#M5338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How are we supposed to remove the onTouchListener when our Activity gets destroyed?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is a setOnTouchlistener but no remove.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Setting it to null won't work - you will throw an exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is important because you are holding on to the reference and our activity can't be garbage collected, causing a huge memory leak.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have used removeListeners for Scale and NavigationChanged.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only thing I can think of now is to create a DummyonTouchListener that does nothing, and set it in onDestroy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Nov 2018 15:29:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/no-mapview-removeontouchlistener-causes-memory/m-p/757051#M5338</guid>
      <dc:creator>NathanMellor</dc:creator>
      <dc:date>2018-11-12T15:29:49Z</dc:date>
    </item>
  </channel>
</rss>

