Here is my code. It just involves 2 buttons and a number counter that goes up and down as the buttons are pressed (both in integer value and text size). This activity is part of a larger application that follows the process: 1. splash screen 2. list menu 3. activity selected in menu (there are 3 options and the counter is one of them)
When i press the back button, it goes back to the list menu and when i click on the integer counter option, i want it to be restored exactly how it was Any ideas on how i can do this? Thanks!
public class StartingPoint extends Activity {
/** Called when the activity is first created. */
int counter;
Button add;
Button sub;
TextView display;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
counter=0;
add= (Button) findViewById(R.id.bAdd);
sub= (Button) findViewById(R.id.bSub);
display= (TextView) findViewById(R.id.tvDisplay);
add.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
counter++;
display.setText(""+counter);
display.setTextSize(counter);
}
});
sub.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
counter--;
display.setText(""+counter);
display.setTextSize(counter);
}
});
}
}