↧
Answer by Christopher Francisco for Background task, progress dialog,...
Did someone from Google provide some "official solution"?Yes.The solution is more of an application architecture proposal rather that just some code. They proposed 3 design patterns that allows an...
View ArticleAnswer by Gotcha for Background task, progress dialog, orientation change -...
This is my solution: https://github.com/Gotchamoh/Android-AsyncTask-ProgressDialogBasically the steps are:I use onSaveInstanceState to save the task if it is stillprocessing.In onCreate I get the task...
View ArticleAnswer by Singagirl for Background task, progress dialog, orientation change...
After 4 years Google solved the problem just calling setRetainInstance(true) in Activity onCreate. It will preserve your activity instance during device rotation. I have also a simple solution for...
View ArticleAnswer by SMBiggs for Background task, progress dialog, orientation change -...
While Mark's (CommonsWare) answer does indeed work for orientation changes, it fails if the Activity is destroyed directly (like in the case of a phone call).You can handle the orientation changes AND...
View ArticleAnswer by Timmmm for Background task, progress dialog, orientation change -...
The accepted answer was very helpful, but it doesn't have a progress dialog.Fortunately for you, reader, I have created an extremely comprehensive and working example of an AsyncTask with a progress...
View ArticleAnswer by Oleg Vaskevich for Background task, progress dialog, orientation...
I've toiled for a week to find a solution to this dilemma without resorting to editing the manifest file. The assumptions for this solution are:You always need to use a progress dialogOnly one task is...
View ArticleAnswer by xpepermint for Background task, progress dialog, orientation change...
you should call all activity actions using activity handler. So if you are in some thread you should create a Runnable and posted using Activitie's Handler. Otherwise your app will crash sometimes with...
View ArticleAnswer by CommonsWare for Background task, progress dialog, orientation...
Step #1: Make your AsyncTask a static nested class, or an entirely separate class, just not an inner (non-static nested) class.Step #2: Have the AsyncTask hold onto the Activity via a data member, set...
View ArticleBackground task, progress dialog, orientation change - is there any 100%...
I download some data from internet in background thread (I use AsyncTask) and display a progress dialog while downloading. Orientation changes, Activity is restarted and then my AsyncTask is completed...
View Article
More Pages to Explore .....