title: How to use PreferenceScreen in Android
body: <p>i want use <code>PreferenceScreen</code> for setting page, i know use <code>EditTextPreferences</code> and use this text. but i don't know other Objects, for example : i don't know change text color from <code>ListPreference</code>, or i don't know show/hide text from <code>CheckBoxPreference</code>. <br></p>
  
  <p><strong>Attention :</strong> Please do not negative.
  I searched on the internet but could not find an appropriate topic, So here's the question I asked.
  Please guide me instead of giving a negative rating!</p>
  
  <p><strong>Main Activity code :</strong> </p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main_page);
  
      ///--- Setting Options
      summary_tv = (TextView) findViewById(R.id.main_summary_text);
      preferences = PreferenceManager.getDefaultSharedPreferences(this);
      String colors = "";
      String main_title_text = preferences.getString("setting_title_text", "main_title");
      summary_tv.setText(main_title_text);
      Boolean main_title_show = preferences.getBoolean("setting_title_show", true);
  </code></pre>
  
  <p><strong>Preference Activity code :</strong></p>
  
  <pre><code>public class SettingPage extends PreferenceActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          getFragmentManager().beginTransaction().replace(android.R.id.content, new MyPreferenceFragment()).commit();
      }
  
      public static class MyPreferenceFragment extends PreferenceFragment
      {
          @Override
          public void onCreate(final Bundle savedInstanceState)
          {
              super.onCreate(savedInstanceState);
              addPreferencesFromResource(R.xml.setting_prefrences);
          }
      }
  }
  </code></pre>
  
  <p><strong>Preference XML code :</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:key="setting_title_title_category"
          android:title="Title options"&gt;
  
      &lt;CheckBoxPreference
          android:id="@+id/setting_title_show_id"
          android:key="setting_title_show"
          android:title="Show Main Title"
          android:summary="Show/hide MainPage title" /&gt;
  
      &lt;EditTextPreference
          android:key="setting_title_text"
          android:title="Set Main Title"
          android:summary="Change MainPage title"
          android:dialogTitle="Change Title"
          android:dialogMessage="Change title please..."/&gt;
  
      &lt;/PreferenceCategory&gt;
  
      &lt;PreferenceCategory
          android:key="setting_title_font_category"
          android:title="Font options"&gt;
  
          &lt;ListPreference
              android:key="setting_title_font_color"
              android:title="Title font colors"
              android:summary="Change title font colors"
              android:entries="@array/colors"
              android:entryValues="@array/colors"
              android:dialogTitle="Change font color" /&gt;
  
      &lt;/PreferenceCategory&gt;
  
      &lt;RingtonePreference
          android:title="tes"/&gt;
  
  &lt;/PreferenceScreen&gt;
  </code></pre>
  
  <p><strong>String XML code :</strong></p>
  
  <pre><code>&lt;resources&gt;
      &lt;string name="app_name"&gt;1-MyTestDb Project&lt;/string&gt;
      &lt;string name="title_activity_settings"&gt;Settings&lt;/string&gt;
  
      &lt;string-array name="colors"&gt;
  
          &lt;item&gt;White&lt;/item&gt;
          &lt;item&gt;Black&lt;/item&gt;
          &lt;item&gt;Primary&lt;/item&gt;
  
      &lt;/string-array&gt;
  
  &lt;/resources&gt;
  </code></pre>
  
  <p>How can use this <strong>preferences</strong> in <strong>java code</strong>. for example change <code>TextView</code> color with <code>ListPreference</code> ?<br></p>