0

Sometimes scrolling my RecyclerView makes the entire UI unresponsive for a few seconds. I did use an AsynchronousTask to update the item and not to block onBindViewHolder.

Is there any way to pinpoint at what method (or code line) the application hangs?

Damn Vegetables
  • 11,484
  • 13
  • 80
  • 135
  • If you can, post your code. It'll be easy to see where is the problem. – Adley Apr 29 '16 at 11:57
  • I found out the problem. I upgraded the OS to Android 7.1, and it randomly crashed instead of just stuttering. I checked the log. `android.os.NetworkOnMainThreadException` exception happened in the `AsynchronousTask`'s `doInBackground()`. After searching StackOverflow, I found this [android.os.NetworkOnMainThreadException in AsyncTask's doInBackground](http://stackoverflow.com/questions/26224016/android-os-networkonmainthreadexception-in-asynctasks-doinbackground). The problem was that I called `doInBackground()` directly, thinking that would run the task asynchronously. – Damn Vegetables Dec 06 '16 at 11:23

1 Answers1

0

I found out the problem. I upgraded the OS to Android 7.1, and it randomly crashed instead of just stuttering. I checked the log. android.os.NetworkOnMainThreadException exception happened in the AsynchronousTask's doInBackground(). After searching StackOverflow, I found this android.os.NetworkOnMainThreadException in AsyncTask's doInBackground. The problem was that I called doInBackground() directly, thinking that would run the task asynchronously. –

MindRoasterMir
  • 324
  • 1
  • 2
  • 18