I have a database in which each Program has Days, and in each day its Tasks. In the activity there is a RecyclerView, which displays all the programs in the database. It is necessary when you click to withdraw a sublist of the days (and in the days of the tasks that they contain) in the same activity. How can this be done?
- Look here, answered a similar question ru.stackoverflow.com/questions/664053/… - Vitaly Robinovsky
- You urgently need to learn about such a discipline as a DBMS and compiling query queries with the conditions of the sample. I can recommend Lynn Bailey's book “Learning SQL” as a good start. Here it is very difficult to answer your question, since it is too general and does not contain a reproducible example and it is not entirely clear what exactly the problem is with you. To give a qualitative answer, you need to rewrite a good half of the above book, no one, of course, will not do this. - pavlofff
|
1 answer
I think that when you click on an item, you can create a new adapter on the fly and call the setAdapter method (newAdapter), while keeping a reference to the RecyclerView object inside the adapter.
- Perhaps this is the most ineffective solution that could come up with - pavlofff
- @pavlofff, I do not agree with you. First, the question is very general and does not clarify any details. Secondly, the author wants to change the state of the UI (no matter in what way) so that when you click on the RecyclerView element, a new list appears, the content of which depends on the choice of the element. Here you already want or not, you will have to either load everything into memory in advance, or make requests in real time and update the list. The author did not indicate the amount of data, so if he has a large database, the first option is no longer suitable. It only remains to load on the fly, preferably, displaying the loading animation. Do you have any other ideas? - Turkhan Badalov
- I, in turn, agree only with the fact that the question is general and it is absolutely not clear what the author needs. To offer in such cases answers that essentially do not solve anything, as it is not accepted on this resource - the question requires clarification in order to get an acceptable solution. Your answer (no less general and requiring clarification) is not effective for the reasons of generating unnecessary objects, not optimized logic and guaranteed memory leaks - pavlofff
- @pavlofff, justify, please, what is guaranteed a memory leak? - Turkhan Badalov
- I have no desire to substantiate something for a knowingly unacceptable solution. If you want, create a test case and go through the profiler. - pavlofff
|