Hi Xavier,

I had a similar problem with the activity state and screen rotation. I
managed to fix this after adding the following attributes for the crosswalk
activity in the android manifest:
            android:launchMode="singleTask"
            android:configChanges="orientation|screenSize"

Hope this helps :)

Regards,
Andreas


On Wed, Feb 25, 2015 at 10:27 AM, Xavier Gibert <[email protected]>
wrote:

>  Hello,
>
> thanks for replying. This code works as well for me but only the first
> run, after a rotation device this code tells me that the view has already a
> parent. When trying both options (restoring state or restoring the whole
> view), I do not reload the url since I expect the browser to get to its old
> state like it was doing in the old architecture. If I reload, it is like
> not saving the state for me.
>
> Regards,
>
> Le 25/02/2015 07:13, Xu, Xing a écrit :
>
>  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]
> <[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
>
>
> --
>
>
> --
>
> _______________________________________________
> Crosswalk-help mailing list
> [email protected]
> https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-help
>
>
_______________________________________________
Crosswalk-help mailing list
[email protected]
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-help

Reply via email to