In my application I have a counter that increases with the use of certain buttons. My problem is that I would like to save the state of the counter. When I close the application and reopen this resets, and I want to show the result that there was before closing the app
code:
TextView Display;
int counter = 0 ;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Display = (TextView)findViewById(R.id.counter);
Button example:
counter = counter-3;
Display.setText(""+counter);