How to Solve Too Much Load

64 views Asked by At

I used Volley library in my apllication for RecyclerView on MainActivity but now when I run my application on android monitor there is saying too much load on main thread. An also main thread load slowly. What can I do?

3

There are 3 answers

2
Mohammed Farhan On BEST ANSWER

If you are passing small amount of dataset to recyclerview then I suggest you to run the method on runOnUiThread

And if datasets are many(long executable code) then better make use of AsyncTask

0
diegoveloper On

Long operations must be executed on the background thread, there are a lot of ways to achieve this : Loaders, Asynctask, handlers ,RXjava, etc.

Refer to this documentation :

https://developer.android.com/reference/android/os/AsyncTask.html https://developer.android.com/training/multiple-threads/communicate-ui.html

0
AudioBubble On

Use AsyncTask to let long operation task execute under worker threads. So UI thread will not suffer from these heavy payload.