Reputation: 637
I have a splash activity, and this activity downloads some XMLs from the internet. All is fine, but the problem is that when the connection is too slow, the OS thinks that the app is unresponsive, and ask to terminate or wait.
How can I prevent this? Or there is a better practice for this kind of things?
Upvotes: 0
Views: 206
Reputation: 30168
You're probably downloading the XMLs in the UI thread. Don't. Use AsyncTasks instead.
Upvotes: 2
Reputation: 3578
Put your Download process in a thread or AsyncTask and leave the main UI thread free then OS will not give you the ANR(Application Not Responding) Dialog Box
Tutorial link for AsyncTask
http://www.vogella.com/articles/AndroidPerformance/article.html
Upvotes: 2