android - Load Fragment before Navigation Drawer closes -


i have implemented navigation drawer , want load fragment before navigation drawer closes. currently, fragment loads in parallel drawer closing, if fragment heavy user interface hangs bit.

the code have is:

private class draweritemclicklistener implements             listview.onitemclicklistener {         @override         public void onitemclick(adapterview<?> parent, view view, int position,                 long id) {                  fragmenttransaction ft = getsupportfragmentmanager().begintransaction();                  ft.replace(r.id.content_frame, fragmentprofile);                  ft.commit();                  drawerlayout.closedrawer(drawernavilistview);         }     } 

how can change see fragment loading (in background) first , when has finished loading, navigation drawer closes?

my solution load fragment after drawer closed: call loadfragment method inside ondrawerclosed

 public void ondrawerclosed() {   // assure request comes selecting menu item, not closing tab  if (selectedtab )       selectitem(mselectedfragment);      selectedtab = false;  } 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -