How To Embed Youtube Video Inwards Android Webview

Posted on 46 views
Android WebView is used to display spider web content inward android app. To display spider web page inward android application, WebView uses webkit. In this example, I volition exhibit how to embed in addition to play YouTube video inward android spider web view. Embedding YouTube video inward android spider web persuasion is rattling simple. Follow the next instructions to embed in addition to play YouTube video inward android app.

Related:
Implementing Navigation Back Feature to Android WebView Application

How to Load HTML Data/String on Android WebView Application

Embed in addition to Play YouTube Video inward Android WebView

To embed YouTube video inward android spider web view, commencement yous accept to add together WebView to your XML activeness layout in addition to add together lilliputian chip code inward coffee activeness file.

Create a novel Android Project

Let’s start creating a novel android projection to embed YouTube video inward WebView amongst next information.
Application Name: Embed YouTube Video inward WebView
Company Domain: viralandroid.com
Package Name: com.viralandroid.embedyoutubevideoinwebview
Minimum SDK: Android 2.2 (API viii Froyo)

Add WebView inward XML Layout

You tin forcefulness out straight drag in addition to driblet WebView to your app xml layout. After adding WebView, your XML activeness layout looks similar this.
res/layout/activity_main.xml

Add YouTube Embed Code inward Java Activity

Following is the in conclusion code of coffee activeness file. Here, I accept added YouTube video embed code inward string in addition to closed to code to command spider web view.
src/MainActivity.java

Add Internet Permission

Before running your application, yous accept to add together meshing permission inward your AndroidManifest.xml file. Final code of your manifest file is looks similar this.

<uses-permission android:name="android.permission.INTERNET"></uses-permission>

AndroidManifest.xml

READ  Bar Nautical Chart Xml Ui Blueprint For Android

You accept done all things. Now piece of employment your application, your app volition similar this.

 is used to display spider web content inward android app How to Embed YouTube Video inward Android WebView

Download Complete Example Project

Download consummate Embed YouTube Video inward Android WebView Example projection origin code from GitHub.