As Turbolinks are deprecated on Android, I'm trying to implement a small fraction of it's functionality myself.
What I'm trying to do is to use NavController and Fragments within my application. The Fragment pretty much only contains a webview.
Now, when someone taps on something in that webview, instead of loading a new page inside that webview, I'd like to programatically create a new (instance of a) Fragment and have the NavController to navigate to the new "page". The advantage would be to get a transition plus I can use the system back button to navigate to previous pages.
At this point I'm not even sure this is possible to do.
the navigate() method takes a fragment ID. If I pass the same ID as the current top-most fragment, nothing happens. So, my idea was to somehow create a duplicate of the current fragment and pass something like navigate(ID_x).
Please note that I'm new to Android and I might be missing something fundamental.
Edit: as request in comments, here as an example
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
Bundle args = new Bundle();
args.putInt("number", 5);
navController.navigate(R.id.open_category, args);
"open_category" is an <action> which should display a new instance of the same fragment. That actually happens (at least the onCreateView() is called) but NavController won't put the new fragment on the top of the stack and I can't got back to the "old" fragment instance.
<action
android:id="@+id/open_category"
app:destination="@id/navigation_blank"
/>