When I'm fetching vast amount of data (in form of videos) from cache the app responds after a long delay.
How do I resolve or fix it?
When I'm fetching vast amount of data (in form of videos) from cache the app responds after a long delay.
How do I resolve or fix it?
While performing long running or computation heavy tasks, you should prefer doing it on a background thread (i.e, separate from the UI thread).
You will see ANRs on the app if the UI thread is kept busy for more than 5 seconds, but even for less than 5 seconds there will be a noticeable lag and delay of user actions (click, scroll) and a similar message in logs as you are seeing (Choreographer : Skipped XXX frames! The application may be doing too much work on its main thread.).
Some of the ways to such perform tasks on background thread are :
Also, be careful while updating the UI from a background thread as Android UI toolkit is not thread-safe.
Edit :
For off-loading tasks from main thread, you can also use :