Dedicated to satisfying your computer needs

twitter button digg button
Subscribe to Blog
Subscribe via email Subscribe via RSS Subscribe via Comments

Ignore Configuration Changes in Android

Posted by Michael Washington On February - 1 - 2010

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

2 Responses to “Ignore Configuration Changes in Android”

  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.

Leave a Reply