Good evening everyone! In general, the problem is this: I make an application dedicated to training in the gym, I do not know how to implement the process of multi-day training in the gym. For example, in order to perform tricks on the first day, tick off the exercises. Then go out of it, thereby retaining the checkmarks that were set before. And so that later the second day of training begins, that is, information is stored that we have already done the first day of training according to the program. I don’t ask you to explain thoroughly what and how, at least throw up a few ideas or sources that will help me. Thank you in advance!
- I think the question is not related to programming. - nick_n_a
2 answers
Think over the interface. What elements ( View ) will be required for this. What information will be in the app. How will you add it, update, delete. Create a sqLite database, let the necessary information be stored there. Since you have some periods of training, then at least this period should somehow be identified in the database. It is the same to determine every day of training within this period. Exercises, respectively, too.
The more carefully you think about what you want to get as a result, the easier and faster this project will turn out to be realized. RuSO to help.
You need to somehow save information about the exercises. On this topic there is a separate section in the Help for Android developers. Three methods are described there:
- Saving key-value sets . The simplest method, however, is not very suitable for large amounts of data.
- Save to file method . It seems to me that this method is the most suitable for your case, since it is quite simple and at the same time quite flexible.
- Using the database . The most correct method, however, will have to learn how to work with databases, which, however, is quite useful.
You can save training data to a file, for example, by converting it to json using the gson library.
- onein this case, the most suitable method will be to save to the database (SQLite or some kind of ORM, like Realm), since sampling for certain periods, certain fields, and so, statistical data are required. - pavlofff
- @pavlofff, you're right. I wrote that the method of saving to the file is the most appropriate since, probably, the author of the question is not yet able to work with databases. - diraria
- one@ El Salvador Dali a good reason to learn how to work with the database. Yes, the organization of the correct database structure and the compilation of queries to it is a rather complicated topic, but using write to a file in your task is obviously the worst decision and eventually you will come to the conclusion that everything needs to be redone to the database - why delay the inevitable. To understand the organization of working with databases, I recommend reading a wonderful book written (like all O'Reilly editions) in a lively and understandable language for beginners: Bailey L. - Learning SQL - 2012, it’s not about Android, but it will help you understand how to arrange DB and how to work with it. - pavlofff
- one@ El SalvadorDali SQLite support is built into the Android API, you do not need to install anything else. But you most likely need a SQLite database manager on your computer for query tests - pavlofff
- one@ El Salvador Dali You can do everything that you need, the database and invented to organize this type of data, and after reading the book, you will learn how to properly, it contains many examples. There are a lot of SQLite database managers, I use SQLite Expert personal (free version, but it has everything you need and even more). It is also convenient to use the manager on a PC for initial filling in the database. - pavlofff