<?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: Screen Rotation issues when targeting Android API levels greater than 13 in ArcGIS Runtime SDK for Android Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/screen-rotation-issues-when-targeting-android-api/m-p/139633#M1039</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;android:configChanges="orientation|screenSize"&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Add this bit of code to your manifest -&amp;gt; activity.&lt;BR /&gt;&lt;BR /&gt;In android 4.x &lt;STRONG&gt;screenSize&lt;/STRONG&gt; flag is a must, as it also triggers activity to be recreated.&lt;BR /&gt;&lt;BR /&gt;Edit: Also, it would be great if someone updated SDK samples to include this for android 4.x ...&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If your application targets API level 13 or higher you should declare the "screenSize" configuration, becuase it changes when a device switches between portrait and landscape.&amp;nbsp; We have added it to SDK samples targeting API level 13 and higher.&amp;nbsp; &lt;/SPAN&gt;&lt;A href="http://developer.android.com/guide/topics/manifest/activity-element.html#config"&gt;Here&lt;/A&gt;&lt;SPAN&gt; is the android guide topic.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Aug 2013 20:10:11 GMT</pubDate>
    <dc:creator>DanO_Neill</dc:creator>
    <dc:date>2013-08-22T20:10:11Z</dc:date>
    <item>
      <title>Screen Rotation issues when targeting Android API levels greater than 13</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/screen-rotation-issues-when-targeting-android-api/m-p/139629#M1035</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I recently set my app to target Android API level 14(ICS).&amp;nbsp; Now when I rotate the map I lose any graphics on a graphics layer and I lose my callout if visible.&amp;nbsp;&amp;nbsp; I've narrowed down the problem to the onRetainNonConfigurationInstance() method.&amp;nbsp; I checked the Android API documentation and It has been depreciated at level 13 in favor of using Fragment.setRetainInstance(true);.&amp;nbsp; Well, I'm not using Fragments. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
/** Called by the system, as part of destroying an activity due to a configuration change. */
&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override
&amp;nbsp;&amp;nbsp;&amp;nbsp; public Object onRetainNonConfigurationInstance() {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return mMapView.retainState();
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Android API Documentation:&amp;nbsp; &lt;/SPAN&gt;&lt;A href="http://developer.android.com/reference/android/app/Activity.html#onRetainNonConfigurationInstance()" rel="nofollow noopener noreferrer" target="_blank"&gt;http://developer.android.com/reference/android/app/Activity.html#onRetainNonConfigurationInstance()&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;H&lt;/A&gt;&lt;SPAN&gt;ow can I target API level 14 and retain my map state without using Fragments?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:42:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/screen-rotation-issues-when-targeting-android-api/m-p/139629#M1035</guid>
      <dc:creator>deleted-user-ATjHIWsdQYmT</dc:creator>
      <dc:date>2021-12-11T07:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: Screen Rotation issues when targeting Android API levels greater than 13</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/screen-rotation-issues-when-targeting-android-api/m-p/139630#M1036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This has long been an issue, is there a resolution?&amp;nbsp; (that doesn't include, at the next release...)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jul 2013 13:35:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/screen-rotation-issues-when-targeting-android-api/m-p/139630#M1036</guid>
      <dc:creator>MilesWacker</dc:creator>
      <dc:date>2013-07-25T13:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: Screen Rotation issues when targeting Android API levels greater than 13</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/screen-rotation-issues-when-targeting-android-api/m-p/139631#M1037</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;By default, the android.view.View is destroyed whenever the phone rotates or you transition to another view. I disagree with that design, but it's fundamental to the Android OS, and it even affects web apps running in the phone's browser. Here's a few ideas that I've used before:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Until you can migrate to Fragments you can "temporarily" continue to use onRetainNonConfigurationInstance() with your current architecture. That's not ideal, of course, but the functionality is deprecated but not gone and removed from the native SDK...yet. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2) You can prevent rotation of the screen but not allowing it in the manifest. I've seen this most often on phones where viewing the map in portrait mode makes the most sense and best use of screen real estate. I understand that might not work with your requirements.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;3) **Make sure you set the android:configChanges property in the manifest's Activity tag. For example, android:configChanges="orientation". This prevents the onCreate event from firing every time the phone rotates. Why? Because every time onCreate fires then depending on how you architected your code it could be rebuilding (or partially rebuilding) your map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can also do the following if #2 above doesn't resolve your issues:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Store any important map or graphic layer values in SQLite or in a singleton&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Listen for rotation events&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3) when phone rotates rebuild the map using the values stored in step #1.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Again, this isn't ideal but the pattern can give you a framework for attempting to maintain map state. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Andy&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Andy&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jul 2013 15:58:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/screen-rotation-issues-when-targeting-android-api/m-p/139631#M1037</guid>
      <dc:creator>AndyGup</dc:creator>
      <dc:date>2013-07-31T15:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: Screen Rotation issues when targeting Android API levels greater than 13</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/screen-rotation-issues-when-targeting-android-api/m-p/139632#M1038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;android:configChanges="orientation|screenSize"&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Add this bit of code to your manifest -&amp;gt; activity.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In android 4.x &lt;/SPAN&gt;&lt;STRONG&gt;screenSize&lt;/STRONG&gt;&lt;SPAN&gt; flag is a must, as it also triggers activity to be recreated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edit: Also, it would be great if someone updated SDK samples to include this for android 4.x ...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Aug 2013 09:51:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/screen-rotation-issues-when-targeting-android-api/m-p/139632#M1038</guid>
      <dc:creator>JuliusBagdonas</dc:creator>
      <dc:date>2013-08-20T09:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: Screen Rotation issues when targeting Android API levels greater than 13</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/screen-rotation-issues-when-targeting-android-api/m-p/139633#M1039</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;android:configChanges="orientation|screenSize"&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Add this bit of code to your manifest -&amp;gt; activity.&lt;BR /&gt;&lt;BR /&gt;In android 4.x &lt;STRONG&gt;screenSize&lt;/STRONG&gt; flag is a must, as it also triggers activity to be recreated.&lt;BR /&gt;&lt;BR /&gt;Edit: Also, it would be great if someone updated SDK samples to include this for android 4.x ...&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If your application targets API level 13 or higher you should declare the "screenSize" configuration, becuase it changes when a device switches between portrait and landscape.&amp;nbsp; We have added it to SDK samples targeting API level 13 and higher.&amp;nbsp; &lt;/SPAN&gt;&lt;A href="http://developer.android.com/guide/topics/manifest/activity-element.html#config"&gt;Here&lt;/A&gt;&lt;SPAN&gt; is the android guide topic.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Aug 2013 20:10:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/screen-rotation-issues-when-targeting-android-api/m-p/139633#M1039</guid>
      <dc:creator>DanO_Neill</dc:creator>
      <dc:date>2013-08-22T20:10:11Z</dc:date>
    </item>
  </channel>
</rss>

