Compose WebView Part 3 | Handle configuration changes

Published: 28 July 2022
on channel: Bolt UIX
1,680
18

WebView With Jetpack Compose in Android Studio | Kotlin | Jetpack Compose | Android Tutorials | Convert Your Website into an App | Build web apps in WebView .

Source code:
https://www.boltuix.com/2022/07/compo...

#android
#webview
#jetpackcompose
#webtoapp
---------------------------------------------------------------------------------------------------
Follow us:

* Instagram:
  / boltuix  

* Facebook:
https://www.facebook.com/profile.php?...

* Twitter
  / boltuix  

* Linkedin
  / bolt-uix-79805223b  

* Youtube
   / @boltuix  

* Medium
  / boltuix  

* Pinterest
  / boltuix  

* Github
https://github.com/BoltUIX

* Learning Hub (Join Us)
http://tekheist.com/

* Bolt UIX
https://www.boltuix.com/


If you want to deliver a web application (or just a web page) as a part of a client application, you can do it using WebView. The WebView class is an extension of Android's View class that allows you to display web pages as a part of your activity layout. It does not include any features of a fully developed web browser, such as navigation controls or an address bar. All that WebView does, by default, is show a web page.

A common scenario in which using WebView is helpful is when you want to provide information in your app that you might need to update, such as an end-user agreement or a user guide. Within your Android app, you can create an Activity that contains a WebView, then use that to display your document that's hosted online.

Another scenario in which WebView can help is if your app provides data to the user that always requires an Internet connection to retrieve data, such as email. In this case, you might find that it's easier to build a WebView in your Android app that shows a web page with all the user data, rather than performing a network request, then parsing the data and rendering it in an Android layout. Instead, you can design a web page that's tailored for Android devices and then implement a WebView in your Android app that loads the web page.

This document shows you how to get started with WebView and how to do some additional things, such as handle page navigation and bind JavaScript from your web page to client-side code in your Android app.
.......................................


Use JavaScript in WebView
If the web page you plan to load in your WebView uses JavaScript, you must enable JavaScript for your WebView. Once JavaScript is enabled, you can also create interfaces between your app code and your JavaScript code.

Handling an orientation change without reloading the page from source each time.

To manually handle orientation changes in your app you must declare the "orientation", "screenSize", and "screenLayout" values in the android:configChanges attributes. You can declare multiple configuration values in the attribute by separating them with a pipe | character.

WebView With Jetpack Compose in Android Studio | Kotlin | Jetpack Compose | Android Tutorials

For example, the following manifest code declares an activity that handles both screen orientation changes and keyboard availability change: (Use android:configChanges)


Watch video Compose WebView Part 3 | Handle configuration changes online without registration, duration hours minute second in high quality. This video was added by user Bolt UIX 28 July 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 1,680 once and liked it 18 people.