i have a total 12 fragment in navigation drawar.. each fragment has volley method. and each fragment display its own volley response except position = 1 and position = 5 fragment.
when my app start
Scenario 1: i open position 1 fragment and after i open position 5 fragment than both fragment has position 1 fragment response.
Scenario 2: if i open position 5 fragment and after open position 1 fragment than both fragment has position 1 fragment response.
Scenario 1 images:
Scenario 2 images:
My fragment transaction method class:
private void showFragment(Fragment fragment) {
llContainer = (LinearLayout)findViewById(R.id.container);
if (fragment != null) {
llContainer.removeAllViewsInLayout();
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.container, fragment, fragment.getClass().getName());
fragmentTransaction.commit();
fragmentManager.popBackStack();
}
}
@Override
public void onItemSelected(int position) {
Fragment frag = null;
switch (position) {
case POS_HOME:
frag = FragmentHome.instance(screenTitles[position]);
break;
case POS_INBOX:
txtToolbarTitle.setVisibility(View.VISIBLE);
txtToolbarTitle.setText("Notifications");
frag = FragmentInbox.instance(screenTitles[position]);
break;
case POS_LOG:
frag = FragmentLog.instance(screenTitles[position]);;
break;
case POS_BOOK:
frag = FragmentBook.instance(screenTitles[position]);
break;
case POS_BUILDING:
frag = FragmentBuilding.instance(screenTitles[position]);
break;
case POS_LAWS:
frag = FragmentLaws.instance();
break;
case POS_DOCUMENT:
frag = FragmentDocument.instance(screenTitles[position]);
break;
case POS_EVENT:
frag = FragmentEvent.instance(screenTitles[position]);
break;
case POS_BOARD:
frag = FragmentBoard.instance(screenTitles[position]);
break;
case POS_AROUND:
frag = FragmentAround.instance(screenTitles[position]);
break;
case POS_PROFILE:
frag = FragmentProfile.instance(screenTitles[position]);
break;
case POS_CONCIERGE:
frag = FragmentConcierge.instance(screenTitles[position]);
break;
}
showFragment(frag);
mSlideMenu.closeMenu();
}