Allowing user to change default screen
<p>My app lets the user choose a default screen for each time the app starts up, and I use SharedPreferences to do it. The app prompts them to choose a screen when it's launched for the first time after being installed, and that part works. However, inside the app where it allows the user to change the default screen, I use the same code and it never stores the change. What do I need to change in order to get it to save properly?</p>

<pre><code>            AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("Choose a Default Screen");
        builder.setItems(R.array.openChoices, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int item) {
                SharedPreferences settings = getPreferences(0);
                SharedPreferences.Editor editor = settings.edit();
                editor.putInt("start", item);
                editor.commit();
                //Mech = 0, E&amp;M = 1
                int choice = getPreferences(0).getInt("start", 3);
                if(choice == 0){
                    Toast.makeText(setscreen.this, "Mechanics is now the default screen", Toast.LENGTH_SHORT).show();
                    Intent myIntent = new Intent(setscreen.this, physics.class);
                    startActivity(myIntent);             
                }
                else if(choice == 1){
                    Toast.makeText(setscreen.this, "E&amp;M is now the default screen", Toast.LENGTH_SHORT).show();
                    Intent myIntent = new Intent(setscreen.this, physicsem.class);
                    startActivity(myIntent);
                }
            }
        });
</code></pre>
