Home » Android » Ignore Configuration Changes in Android

Ignore Configuration Changes in Android

When programming on the android I encountered a error called android.view.AbsSavedState which happens whenever you do any type of screen orientation or slide out your keyboard. So I decided the best way for me to avoid this error was to ignore any type of screen orientation.

add a couple of attributes in your manifest file
<activity  android:name=”(Put in your activity name if not already entered)”  android:screenOrientation=”portrait or landscape (choose one)”  android:configChanges=”orientation|keyboardHidden” />

place the following code into the class that extends Activity

@Override

public void onConfigurationChanged(Configuration newConfig) {

super.onConfigurationChanged(newConfig);
}

That it!

References:

  1. http://developer.android.com/reference/android/app/Activity.html#onConfigurationChanged%28android.content.res.Configuration%29
  2. http://developer.android.com/guide/topics/manifest/activity-element.html
Bookmark and Share

Popularity: 1% [?]

Random Posts

4 Comments

  1. Daniel, a very interesting post thanks for writing it!

  2. payday loans says:

    I want to thank the blogger very much not only for this post but also for his all previous efforts. I found compscistuff.com to be very interesting. I will be coming back to compscistuff.com for more information.

  3. I just found this blog a while back when a good friend suggested it to me. I’ve been an avid reader ever since.

  4. Richard says:

    I just found this blog a while back when a good friend suggested it to me. I’ve been an avid reader ever since.

Leave a Reply

Copyright © 2010 · Comp Sci Solutions · All Rights Reserved · Posts · Comments