title: Android SwitchPreference using Fragment
body: <p>I've an activity to represent a preference screen using one FragmentPreference.</p>
  
  <p><strong>Activity layout:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:orientation="vertical" &gt;
  
  &lt;fragment
      android:id="@+id/frag"
      android:name="com.test.preference.Frag"
      android:layout_width="match_parent"
      android:layout_height="wrap_content" /&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>Preference xml:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" &gt;
  &lt;PreferenceCategory android:title="General"&gt;
      &lt;SwitchPreference android:title="Enable module" android:key="asd" android:summaryOff="Turn on module" android:summaryOn="Turn off module"/&gt;
      &lt;SwitchPreference android:title="Post in application" android:key="qwe" android:summary="Show posts in application"/&gt;
      &lt;SwitchPreference android:title="Post in widget" android:key="zxc" android:summary="Show posts in widget"/&gt;
  &lt;/PreferenceCategory&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>Activity class:</strong></p>
  
  <pre><code>public class TestActivity extends Activity {
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  }
  }
  </code></pre>
  
  <p>and finally <strong>Fragment class:</strong></p>
  
  <pre><code>public class Frag extends PreferenceFragment{
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      addPreferencesFromResource(R.xml.test);
  }
  }
  </code></pre>
  
  <p>Activity starts normally but when I click on a first SwitchPreference, its status remains equal and the other two SwitchPreference change their status!</p>
  
  <p>If I use deprecated method (PreferenceActivity without fragment) it works.</p>
  
  <p>Someone can help me?</p>
  
  <p>Giulio</p>