Listpreference launching new activity
<pre><code>import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.preference.PreferenceActivity;
public class Preferences extends PreferenceActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.preferences);


    SharedPreferences SP = PreferenceManager
            .getDefaultSharedPreferences(getBaseContext());

    String listPref = SP.getString("listPref", "No City Selected");
    SP.getString("listPref", "No City Selected");
    SP.contains(listPref);

    if (listPref == "Aplpharetta") {
        Intent myIntent = new Intent(Preferences.this, Contents.class);
        Preferences.this.startActivity(myIntent);

    } else if ("Greenville".equals("Greenvile")) {
        Intent myIntent = new Intent(Preferences.this, Contents.class);
        Preferences.this.startActivity(myIntent);

    } else if   ("Houston".equals("Houston")) {     
        Intent myIntent = new Intent(Preferences.this, Contents.class);
        Preferences.this.startActivity(myIntent);
    }}}
</code></pre>

<p>Here is the Arrays file
    
    </p>

<pre><code>&lt;string-array name="listArray"&gt;
    &lt;item&gt;Alpharetta&lt;/item&gt;
    &lt;item&gt;Greenville&lt;/item&gt;
    &lt;item&gt;Houston&lt;/item&gt;
    &lt;item&gt;Tampa&lt;/item&gt;
&lt;/string-array&gt;

    &lt;string-array name="listValues"&gt;
    &lt;item&gt;Alpharetta&lt;/item&gt;
    &lt;item&gt;Greenville&lt;/item&gt;
    &lt;item&gt;Houston&lt;/item&gt;
    &lt;item&gt;Tampa&lt;/item&gt;
&lt;/string-array&gt;
&lt;/resources&gt;
</code></pre>

<p>The problem I am having is making the activity start when a listpreference is selected. I have tried the two ways listed above, the list lets you select the item, but not trigger the other activity to start. The arrays list is set up without integers due to the information being populated in another part of the app. I have tried    setOnPreferenceChangeListener() and    setOnPreferenceClickListener() . With using those, the preference screen would flash up for a send and return right back to the previous screen like it is starting the activity, but doesn't stay open long enough if you need to make a change. This is my first attempt at making a preference screen, so I am not sure if I am missing something or going about this the entirely wrong way.</p>
