Friday, 3 March 2017

android - How to implement multiple cordova webviews in an Activity using fragments?

I’m trying to build an android app using phonegap with several Cordova webviews. Now in order to do that, I’ve tried to create a FragmentActivity that implements CordovaInterface. However, the Cordova webviews in the fragments are losing their state whenever I switch between the fragments or as soon as there is a configuration change on android.



To switch between fragments, I’m using:



FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(container, frag)
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
.addToBackStack(null)

.commit();


where container is the fragment container and frag is my Cordova webview fragment



Any idea why the replace function is not saving the state of the current Cordova webview?

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...