title: how do you have two buttons that save to the same data file in android?
body: <p>I have it set up so when you click one of the words it will add 10 points and the other will add 5 points but I want it to be typed out in the same textview, however im not sure how to do it because how I have it right now it wants me to change the settings and editor to "settings1" and "editor1" but if I do that it will no longer type the amount of points out in the "test" TextView. I hope I expaned it good enough, thanks for helping</p>
  
  <p>heres my code</p>
  
  <pre><code>public class page1 extends Activity implements OnClickListener 
  {
  
      TextView Q1A1;
      TextView Q1A2;
      TextView test;
  
      public static final String PREFS_NAME = "MyPrefsFile";
      public static final int testScore = 0;
  
      @Override
      public void onCreate(Bundle savedInstanceState)
      {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.test);
          Q1A1 = (TextView) findViewById(R.id.Q1A1);
          Q1A2 = (TextView) findViewById(R.id.Q1A2);
          Q1A1.setOnClickListener(this);
          Q1A2.setOnClickListener(this);
          test = (TextView) findViewById(R.id.test);
  
  
  
  
          SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
          test.setText(""+settings.getInt("YourScore", 0));
  
  
      }
  
      public void onClick(View v) 
      {
          switch(v.getId())
          {
          case R.id.Q1A1:
  
              SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
              SharedPreferences.Editor editor = settings.edit();
              editor.putInt("YourScore", (testScore + 10));
              editor.commit();
  
              //Intent FinalScore = new Intent(this, FinalScore.class);
              //startActivity(FinalScore);
              break;
          case R.id.Q1A2:
  
              SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
              SharedPreferences.Editor editor = settings.edit();
              editor.putInt("YourScore", (testScore + 5));
              editor.commit();
  
              break;
          }   
      }   
  }
  </code></pre>