kenneth argo
kenneth argo

Reputation: 1

Android settings change when scrolling

I have a pretty standard PreferenceFragment, it is implemented using a FragmentActivity. Nothing really special but I have some (small number) of people using that app reporting that as they scroll the settings some randomly turn themselves off or on. The definitions are pretty simple: 1 below

    <SwitchPreference
        android:key="speechEnabled"
        android:persistent="true"
        android:defaultValue="true"
        android:title="some title"
        android:summary="summary text" />

This is a video from one person reporting the issue:

https://drive.google.com/file/d/0Bx67XBdVKhrKUDVJS24zWmtUa1k/view?usp=sharing

Upvotes: 0

Views: 120

Answers (1)

Daniel Nugent
Daniel Nugent

Reputation: 43322

It's hard to tell anything without seeing the code, but I've come across the issue with an Activity being re-created on portrait/landscape change.
In order to fix it, I added android:configChanges="orientation" in the manifest for the Activity, like this:

<activity android:name="com.example.app.ExampleActivity" android:theme="@android:style/Theme.NoTitleBar" android:configChanges="orientation" >
</activity>

You might also need to call setRetainInstance, for more info see this post: android:configChanges="orientation" does not work with fragments

Upvotes: 0

Related Questions