Showing posts with label Python Kivy Android Webview. Show all posts
Showing posts with label Python Kivy Android Webview. Show all posts

Create a Python Kivy Android WebView App

 🐍 Introduction

In this tutorial, I'll show you how to create a simple WebView app using Python and Kivy. This app will display any website (like Google, YouTube, or your own) in an Android WebView.


We’ll use:

Python 💻

Kivy 🐍

Android (via Buildozer) 📱


Python Code (main.py)


from kivy.app import App
from jnius import autoclass
from kivy.clock import Clock
from android.runnable import run_on_ui_thread
from kivy.uix.widget import Widget

WebView = autoclass('android.webkit.WebView')
WebViewClient = autoclass('android.webkit.WebViewClient')
activity = autoclass('org.kivy.android.PythonActivity').mActivity

@run_on_ui_thread
def create_webview(*args):
	webview = WebView(activity)
	webview.getSettings().setJavaScriptEnabled(True)
	wvc = WebViewClient()
	webview.setWebViewClient(wvc)
	activity.setContentView(webview)
	webview.loadUrl('https://littleone7a.blogspot.com/')


class Wv(Widget):
	def __init__(self, **kwargs):
		super().__init__(**kwargs)
		self.__functionstable__ = {}
		Clock.schedule_once(create_webview, 0)


class ServiceApp(App):
	def build(self):
		return Wv()

if __name__ == '__main__':
    ServiceApp().run()

🛠️ buildozer.spec Settings (Important)

requirements = python3,kivy,android,docutils,pyjnius
android.permissions = INTERNET
android.archs = arm64-v8a


📦 Build APK
command : -  buildozer -v android debug


🌐 Final Output

Your app will open a WebView and load the website you specify inside the app! You can change the URL in webview.loadUrl("...").



Tags :

Python Kivy Apps , Python Kivy , Python Kivy WebView , Python Kivy WebApp ,Python Pyjnius , Python Android Apk , Python Buildozer , Android Python Kivy ,Kivy Applications ,



Create a Smooth Loading Ball Animation in Python Using Kivy

 🎯 Create a Smooth Loading Ball Animation in Python Using Kivy  Are you looking to build a visually appealing loading animation for your P...