In my android application an activity takes more than 10 seconds to load (it contains a number of TextViews with lengthy text values), now I want to show a progress bar dialog window during the Activity loading? Is it possible by using ‘AsyncTask’? if possible then how can I pause the UI thread until AsyncTask to complete,.When I tries to show a dialog before setContentView() call I got an error like
android.view.WindowManager$BadTokenException: Unable to add window — token null is not for an application
In my android application an activity takes more than 10 seconds to load (it
Share
You can use
AsyncTaskandViewswitcherto switch between two layouts(each layout is a view).First set yourcontentViewand inonPostExecute(after loading) switch your layouts.Edit:
For more details,see this page.