Reputation: 592
I am narrowing down and explaining as simple as can, main activity initiates an async task.
When orientation change onCreate()
is recalled so Async
is created once gain. so in onPreExecute()
i lock my orientation and in onPostExecute()
i release lock on orientation. By this way if Async
task has started another instance of task will never get created.
another issue has started, in main activity itself findViewById()
returns null when i randomly keep changing the screen orientation. Re-producing once in 5-6 tries.
how to go on this? any help
Does onCreate()
get re-called after completion of method or main thread... or is it instantaneous as soon as orientation get changed
Thank you
---------------updated
<application
android:allowBackup="true"
android:icon="@drawable/ap_logo"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="agilepoint.android.mobilebpm.main.LoginActivity"
android:configChanges="orientation"
android:label="@string/app_name"
android:logo="@drawable/menu_button"
android:windowSoftInputMode="adjustPan|stateHidden"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="http" />
</intent-filter>
</activity>
</application>
Upvotes: 0
Views: 1761
Reputation: 592
Found my solution...
android:configChanges="orientation" does not work with fragments
if you want to prevent runtime restarts due to orientation change when developing for API level 13 or higher (as declared by the minSdkVersion
and targetSdkVersion
attributes), you must include the screenSize
value in addition to the orientation
value. That is, you must declare android:configChanges="orientation|screenSize"
.
Upvotes: 5
Reputation: 1431
Add android:configChanges="orientation" for that perticular activity in manifest.
Upvotes: 0