title: Alternative to addPreferencesFromResource as its deprecated
body: <p>I create Preference activity on my app to allow user to start/stop background splash screen music as follow :</p>
  
  <pre><code>public class Prefs extends PreferenceActivity{
  
  @SuppressWarnings("deprecation")
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);    
      // TODO Auto-generated method stub
      super.onCreate(savedInstanceState);
      addPreferencesFromResource(R.xml.prefs);
  
  
      }    
  }
  </code></pre>
  
  <p>and inside xml folder create prefs.xml :</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;CheckBoxPreference 
           android:title="splash music" 
           android:defaultValue="true" 
           android:key="checkbox" 
           android:summary="Plese remove music "/&gt;
      &lt;/PreferenceScreen&gt;
  </code></pre>
  
  <p>and this code for splash activity :</p>
  
  <pre><code> public class Splash extends Activity{  
      MediaPlayer ourSong;
  @Override
  protected void onCreate(Bundle Drandroid) {
      this.requestWindowFeature(Window.FEATURE_NO_TITLE); 
      // TODO Auto-generated method stub
      super.onCreate(Drandroid);
           setContentView(R.layout.splash);  
  
      ourSong = MediaPlayer.create(Splash.this, R.raw.splashsound); 
  
       SharedPreferences getPrefs = 
                 PreferenceManager.getDefaultSharedPreferences(getBaseContext());
      boolean music = getPrefs.getBoolean("checkbox", true);
      if (music == true)      
      ourSong.start();
  
      Thread timer = new Thread(){
          public void run(){
              try{
                  sleep(5000); }
                catch (InterruptedException e){
                  e.printStackTrace(); }
                finally{
      Intent openTurkeyTrip = new Intent("com.android.dr.MENU");
  
          startActivity(openplanet); }}                                   
                                  };
           timer.start();   }
  
  @Override
  protected void onPause() {
              // TODO Auto-generated method stub
      super.onPause();
      ourSong.release();
      finish();
            } 
         }
  </code></pre>
  
  <p>how can i solve it with other class which is not deprecated also my app will support old and new devices as below  :</p>
  
  <pre><code>  &lt;uses-sdk
      android:minSdkVersion="8"
      android:targetSdkVersion="17" /&gt;
  </code></pre>
  
  <p>any advice will be appreciated, thanks.</p>