I used TabNavigation in my application. But I am facing difficulty in move back to respective fragment .In my application I have multiple fragment.I implement B fragment with single button which is navigate to A fragment only. But I am sending data from many fragment to B but I am facing difficulty in navigate to respective fragment.Ex if am send data from C to B then I want move back to C instead of A. or if I send data from D-B then I want to move back D.Could you tell me how could I solve this issue.Because In B fragment’s Button I have written code for navigate to A only.Please any one tell me how I solve this issue. I am attaching code here
In A .code for send data to B
B b==new B();
Bundle bundle=new Bundle();
CarBean carbean=new CarBean();
carbean.setName(txt_cardesc.getText().toString());
carbean.setPrize(txt_carprize.getText().toString());
carbean.setAvgPrize(txt_vat.getText().toString());
carbean.setImage("R.drawable.img"+currentposition);
carbean.setArrayList(mylist);
bundle.putParcelable("data", carbean);
carfragment.setArguments(bundle);
mActivity.pushFragments(com.media.contractcar.base.AppConstants.TAB_HOME, b, true, true);
In B
mActivity.pushFragments(com.media.contractcar.base.AppConstants.TAB_HOME, new A(), true, true);
In C.Code for data is send to B
B b==new B();
Bundle bundle=new Bundle();
CarBean carbean=new CarBean();
carbean.setName(txt_cardesc.getText().toString());
carbean.setPrize(txt_carprize.getText().toString());
carbean.setAvgPrize(txt_vat.getText().toString());
carbean.setImage("R.drawable.img"+currentposition);
carbean.setArrayList(mylist);
bundle.putParcelable("data", carbean);
carfragment.setArguments(bundle);
mActivity.pushFragments(com.media.contractcar.base.AppConstants.TAB_HOME, b, true, true);
In B
mActivity.pushFragments(com.media.contractcar.base.AppConstants.TAB_HOME, new A(), true, true);
But problem is How could I navigate to C.If I send data from different fragment then I want move back to respective fragment.