I have this scenario where I have An Activity(A) which has 2 tabs (ie. two fragments FA1,FA2) . The appBar in Activity A has a filter button which opens different Activities(B & C) depending on which tab is selected. this has been handled by the following code in A.
toolbar.findViewById(R.id.filterimage).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = null;
if (tabLayout.getSelectedTabPosition() == 1) {
i = new Intent(A.this, B.class);
} else {
i = new Intent(A.this, C.class);
}
startActivityForResult(i, 221);
}
});
all the api hits to show data in two fragments are made in the respective fragments. Filter which has been selected from Activity B or C is returned to activity A . Now depending on the filters selected I want to refresh the fragment(FA1 or FA2) again from it's parent activity ie. A. But I am unable to do so . How can I do this?