I am using the Navigation in my app with single Activity.
How can I solve the problem that when come back to previous fragment (using navigateUp(), call another time the api that populate recyclerview? In my recyclerview I have the pagination...so this is a big problem.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (mView == null) mView = FragmentListBinding.inflate(inflater, container, false);
return mView.getRoot();
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
initUI();
getUsers();
}
I'am using if (mView == null) to do not inflate again the layout but I have always the call getUsers() that starts a server request passing pagination params and add again the same last result on my recyclerview