Search code examples
androidfileinputstream

Writing text files android same activity different output


I am working on an android application for a final project in a class. It is a weightlifting application. I have 90 days written in, and each one of the days will take you to one of 14 workouts. Which workout (activity) it takes the user too is hardcoded in. I want to have a button on each activity that confirms completion of that day, and stores that information in a text file. How can I use track this information?

More specifically, if the user clicks on day 5, it takes them to a core workout. If a user clicks on day 12, it takes them to the same core workout (same activity). But when the user clicks the 'finished' button, how can I ensure that my text file will know the difference between the day 5 and the day 12 workout, considering it is being generated by the same button click/code?


Solution

  • You can use a general activity to move to and just populate the data in that activity with extras tagged onto an intent when you start the activity, then you will be using the same activity and the data will be different. You'd then have to do some logic when you click finished using some of the data on the page (like where it says the day) to determine what to do with it