Question

I would like to have a Toast Message appear while my app is downloading information but even if I put it before my code it doesn't appear until after the download has completed. Putting my code in a separate thread causes many headaches but putting toast in a separate thread doesn't work either. Is there anyway I can have this Toast message come up before this or am I just going to have to work through the headaches?

Was it helpful?

Solution

You should be putting asynchronous downloads in a separate thread anyway, so as to not disable the main thread's UI. When you call a blocking I/O method, the UI will not respond.

Check out this documentation on Handling Expensive Operation in the UI Thread.

OTHER TIPS

As magaio already said you should use another thread for downloading stuff. My two cents:

  • use progress dialog instead of Toast so User can actually see the process
  • Use AsyncTask for download to update progress so user can actually see the progress
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top