-3
public class excuse extends Activity{
    String excuse[] = { "1", "2","3", "4", "5", "6","7","8", "9","10" };
    Button re;
    Button pre;
    TextView dis;
    int counter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.excuse);        
        re = (Button)findViewById(R.id.button1);
        pre = (Button)findViewById(R.id.button2);
        dis = (TextView)findViewById(R.id.textView1);
        counter = 0; 
        counter = counter + 1;
        dis.setText( " hi" + counter );
        counter = counter + 1;
    }
    @Override
    protected void onPause() {
        super.onPause();        
    }
}

How do I save counter somewhere so that when it changes activities and comes back it knows were counter left off? Also, I left out the button functions for space. Also, are there any tutorials anywhere on this?

David Gorsline
  • 4,933
  • 12
  • 31
  • 36
user3396986
  • 23
  • 1
  • 6
  • possible duplicate of [Saving Activity state in Android](http://stackoverflow.com/questions/151777/saving-activity-state-in-android) – 323go Mar 17 '14 at 01:34

1 Answers1

0

For a more generic answer of "how do i save some data between runs", check out the Storage Options Guide. The easiest to use is probably the one for Shared Preferences.

scottt
  • 8,301
  • 1
  • 31
  • 41