android - Delay when drawer is being closed on loading a fragment with a lot of data -


on fragments not loading lot of data load , drawer closes quick.

however when loading fragment lot of data there delay when drawer closed.

i have setup progress bar on main layout show , put data loading view.post(new runnable() drawer still has delay when closing. maybe im not doing right?

on fragments oncreateview method have this

@override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) {     view view = inflater.inflate(r.layout.fragment_icon_request_list, container, false);      if (view != null) {         progressbar = (progressbar) getactivity().findviewbyid(r.id.base_progressspinner);         progressbar.setvisibility(view.visible);         view.post(new runnable() {              @override             public void run() {                 try {                     initcards();                 } catch (ioexception e) {                     e.printstacktrace();                 } catch (packagemanager.namenotfoundexception e) {                     e.printstacktrace();                 }             }         });     }     return view; } 

initcards() method doing work. there no work being done on oncreate or onactivitycreated

what doing wrong?

you can try using delay , below :

new handler().postdelayed(new runnable() {     public void run() {         initcard();     } }, 1000); 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -