Hi, Gilbert, I add the following code into Activity::onCreate, it behaves well:
RelativeLayout root = new RelativeLayout(this);
XWalkView xWalkView = new XWalkView(this, this);
xWalkView.load(TARGET_URL, null);
root.addView(xWalkView);
setContentView(root);

About the black browser, did you load the url again after remove-add?

From: Crosswalk-help 
[mailto:[email protected]] On Behalf Of Xavier 
Gibert
Sent: Thursday, February 19, 2015 10:25 PM
To: [email protected]
Subject: [Crosswalk-help] saving xWalkView state

Dear developpers,

I changed my Android application from Activity-Fragments-xWalkViews 
architecture to a single Activity-xWalkView. Before, I was saving all 
xWalkViews in a retained fragment to save their state and reload them when 
changing device orientation.

If I try to do the same with the new architecture, when adding the view to the 
layout I get an error telling me that the view already has a parent; probably 
the activity doesn't destroy the layout like for the fragments. So, I remove 
the view before adding it again from the retained fragment. The result is a 
black browser.

I am using all the OnResume, OnPause, OnNewIntent.... and only destroying the 
xWalkView if onDestroy isFinishing();

I found that for the WebView is actually the state Bundle what has to be saved. 
But, If I try to save and restore the state I also get the black browser. 
Looking to the mMap variable of the Bundle after saving, it contains NullPonter 
exceptions.

Is there a better way ? is there any documentation regarding that ? I am using 
maven2:org.xwalk:xwalk_core_library_beta:11.40.277.6

Thanks in advance

--
[cid:[email protected]]
_______________________________________________
Crosswalk-help mailing list
[email protected]
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-help

Reply via email to