The bluetooth keyboard will destroy and restore activity

The Bluetooth keyboard will cause the activity to be destroyed and recreated if I turn it off or away from the pad (Android) Activity will be recreated how can I avoid this problem

+7
android android-activity bluetooth keyboard
source share
2 answers

Bluetooth keyboard pairing is considered a configuration change: Try adding below to your AndroidManifest.xml

Android: configChanges = "keyboard | keyboardHidden"

C: http://developer.android.com/guide/topics/manifest/activity-element.html#config android: configChanges

+10
source share

Unlike the accepted answer , I found that keyboard|keyboardHidden not enough. I worked with a Logitech Bluetooth keyboard ( model # JNZYR0021 ).

What kind of work is this:

 <activity ... android:configChanges="orientation|screenSize|keyboard|keyboardHidden|navigation" /> 

Apparently, this Logitech keyboard also changes navigation , which is strange because Android docs says:

Changed the type of navigation (trackball / dpad). (This should never happen normally.)

Show drawing.

+11
source share

All Articles