Monday, 15 September 2014

android - Progress Dialog not showing during UI task -



android - Progress Dialog not showing during UI task -

i writing android app needs list active , disabled packages. i'd show progress dialog because takes while, , don't want maintain screen "hung" while process completes.

this of import snippet:

pm = getpackagemanager(); progressdialog pd = progressdialog.show(this, "please wait", "loading packages..."); pkgsen = packagelister.retrievepackagelist(pm, getresources(), packagelister.packages_enabled); pkgsdis = packagelister.retrievepackagelist(pm, getresources(), packagelister.packages_disabled); laen = new packageadapter(getbasecontext(), r.layout.packageinfo, pkgsen); ladis = new packageadapter(getbasecontext(), r.layout.packageinfo, pkgsdis); lven = new listview(getbasecontext()); lvdis = new listview(getbasecontext()); pd.dismiss();

there's no error message, freezes screen until listing completed.

thanks time!

calling show() on progress dialog not instantly show it. need retrieve bundle list in loader or asynctask , dismiss progress dialog after background work done. doing work sequentially on main thread wont allow dialog shown.

android progressdialog

No comments:

Post a Comment