android - Navigate to main fragment from viewpager -


i have created navigation drawer in mainactvity , main fragment. want navigate viewpager mainfragment clicking on gridview. here code of gridview:

                android.support.v4.app.fragment fv;                      case 4:                              fv=new events();                              android.support.v4.app.fragmenttransactio fts=getfragmentmanager().begintransaction();                              fts.replace(r.id.fragment_container,fv,"visible_fragment");                              fts.addtobackstack(null);                              fts.commit();                     break; 

my events.java viewpager fragment android.support.v4.app.fragment.

and viewpager cannot navigate mainfragment, when click main fragment whole content display inside viewpager.
have implemented onbackpressed in mainactivity follow:

      @override      public void onbackpressed() {       if(getfragmentmanager().getbackstackentrycount() != 0) {         getfragmentmanager().popbackstack();         } else {             super.onbackpressed();             }          } 

i not able goto viewpager fragment main fragment , cannot goto main fragment view pager.
navigation drawer can goto viewpager fragment.


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -