Answer the question
In order to leave comments, you need to log in
How to quickly display data?
Hello. I am studying mobile development, I would like to know what are the best practices in matters of fast data display, and in general I would be grateful for advice on what, how and in which direction to dig) To the point:
There is an authorized user who goes to the "My recipes" page. If I make a regular (synchronous/in the main thread - I'm a little confused in terms, don't judge strictly :)) query to the database, then the user interface freezes waiting for data - everything is clear so far. If I do it asynchronously (it will be displayed when loaded), then I avoid freezing the user interface, however, the transition is made to a page where the recipes are not yet displayed, because they did not have time to load, and they appear after a couple of seconds - also not the case.
Basically the questions are:
How are such tasks solved - do you need to store some of the user data in a local database in order to quickly display them? Or is there some way to use caching? In particular, I'm interested in how to store correspondence between users, because there are far from 5 or 10 messages, how is it generally accepted to implement such a thing?
I would be grateful for any bits of information.
Answer the question
In order to leave comments, you need to log in
And what prevents them from loading them separately as they scroll, and not all at once.
Normal practice is to show a progress bar while the data is being loaded.
Whether you need caching or not depends on the requirements. It should be borne in mind that when adding local caching, the logic of working with data will become more complicated due to the need to obtain data from several sources, cache invalidation and synchronization.
And yet - never load data in the main thread. Only asynchronously.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question