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
Post a Comment