Android Question WebView orientation change

walterfn2

Member
Licensed User
I'm developing some small application, which has to run mobile "html web app" in full screen and without possibility to zoom.

The problem is that once I change orientation, "html web app" is reloaded in WebView every time. So if user navigates somewhere and changes orientation it goes back to beginning of "html web app".

I know about StateManager, but it is possible to save state of WebView? (Saving on Activity_Pause and loading on Activity_Resume WebView URL won't help, because "html web app" has Javascript which does some changes on Map it puts some markers and layers.

Any solution for this?

Thank you
 

walterfn2

Member
Licensed User

Thank you for your reply.

Solution you sent does not solve this. Page is fully reloaded after orientation changes using URL, but if user navigates through page and that changes are not represented in URL, they are gone after rotation, because page is fully reloaded.

To get idea better, open standard Android web browser, open www.google.com in mobile version. Click on bottom of the page "Settings", menu should appear, now if you rotate phone, that menu will stay and page won't be reloaded.

So, my question was how to do that? :)

Thanks
 
Upvote 0

walterfn2

Member
Licensed User
You can prevent the activity from recreating with this manifest code:
B4X:
SetActivityAttribute(Main, android:configChanges, "orientation|keyboardHidden|screenSize")

The problem is that no event will fire when the orientation changes.

I tried as you said, but during building it gives error:

AndroidManifest.xml:18: error: Error: String types not allowed (at 'configChanges' with value 'orientation|keyboardHidden|screenSize').
 
Upvote 0

walterfn2

Member
Licensed User
You can prevent the activity from recreating with this manifest code:
B4X:
SetActivityAttribute(Main, android:configChanges, "orientation|keyboardHidden|screenSize")

The problem is that no event will fire when the orientation changes.

Yes, no event is fired... Is there a way to resize webview object to fit screen after orientation changes?

Thank you
 
Upvote 0

Jmu5667

Well-Known Member
Licensed User
Hi where in the manifest file do you put the code. I have an separate activity with a webview for my help in the app. I have modified the activity's screen orientation so both modes are supported, but I want to maintain the current position in the webview.

Regards

John
 
Upvote 0
Top