I have created a stopwatch consisting of hours, minutes and seconds. Ideally, I want the user to click on a button when they wish to stop the stopwatch, saving the time's value. I need this integer to be stored.
The next time the user does this, the int will be stored again, not overwriting the existing int stored from before, as I need two integers. So now there should be two integers, stored in a database or something like SharedPrefences.
How would this be achievable, considering it's from the same TextView?
Thanks
Why not use an ArrayList and each time you grabbing those integers, store them inside an ArrayList, and afterward they can be retrieved to store any where as elements 0 and 1.
ArrayList<Integer> integerArrayList= new ArrayList<>();
//calling this below each time hitting the button
int theInt=Integer.parseInt(txt.getText().toString());
integerArrayList.add(theInt);