An easy way to discover where a thread thread has stalled on Android?

I took over the Android project from a past employee, and I wonder if there is a simple tool for profiling an Android application. I have a LinearLayout with a built-in ProgressBar counter. Now I am starting a network call in another thread while this counter is showing. I use translation animations to show the entire LinearLayout, and when the network call returns in another thread, I hide the LinearLayout. Now this works fine, but I see that the spinning type stops while it is showing. Now it looks as if I interacted with the screen, for example, scrolling, the spinner will continue to spin. For a standard ProgressBar counter, do I need to set some command on the counter so that it rotates? Any information on this would be great.

thanks

+7
source share
2 answers

You can use StrictMode to detect costly calls that are made in the user interface thread.

+10
source

Why not try implementing a network call in AsyncTask ? In the implementation of the onPostExecute method onPostExecute you can do everything that is necessary in the user interface (i.e. Hide your progressBar, etc.).

Or if you are using a compatibility / support library or targeting Honeycomb or later, use Loader instead.

0
source

All Articles