{"id":170,"date":"2021-02-25T13:33:07","date_gmt":"2021-02-25T12:33:07","guid":{"rendered":"http:\/\/filiz.it\/?p=170"},"modified":"2021-02-25T13:33:08","modified_gmt":"2021-02-25T12:33:08","slug":"android-tv-app-with-webview","status":"publish","type":"post","link":"http:\/\/filiz.it\/index.php\/2021\/02\/25\/android-tv-app-with-webview\/","title":{"rendered":"Android TV App with WebView"},"content":{"rendered":"\n<p>In this tutorial I\u00b4m going to create an Android TV App where the main part consist of a WebView.\u00a0<\/p>\n\n\n\n<h4>Step 1: \u00a0Create a new Android TV App with Android Studio\u00a0<\/h4>\n\n\n\n<p>Be sure you have all necessary tools installed.<\/p>\n\n\n\n<p>Go to Android Studio <strong>File->New->New Project<\/strong> and select Blank Activity.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"901\" height=\"680\" src=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/create_new_tv_app_1.png\" alt=\"\" class=\"wp-image-171\" srcset=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/create_new_tv_app_1.png 901w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/create_new_tv_app_1-300x226.png 300w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/create_new_tv_app_1-768x580.png 768w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/create_new_tv_app_1-508x383.png 508w\" sizes=\"(max-width: 901px) 100vw, 901px\" \/><\/figure>\n\n\n\n<p>Enter the name of the App, select the language and the API level. You can choose here your preferred version or language. I will use Java.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"899\" height=\"679\" src=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/create_new_tv_app_2.png\" alt=\"\" class=\"wp-image-172\" srcset=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/create_new_tv_app_2.png 899w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/create_new_tv_app_2-300x227.png 300w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/create_new_tv_app_2-768x580.png 768w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/create_new_tv_app_2-508x384.png 508w\" sizes=\"(max-width: 899px) 100vw, 899px\" \/><\/figure>\n\n\n\n<h4>Step 2: Setup Emulator<\/h4>\n\n\n\n<p>Before we are creating the MainActivity let\u00b4s setup the Emulator. <\/p>\n\n\n\n<p>Click on the AVD Manger icon upper left in the IDE.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"182\" height=\"58\" src=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-09.00.13-1.png\" alt=\"\" class=\"wp-image-177\"\/><\/figure>\n\n\n\n<p>Click create virtual device.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"354\" height=\"107\" src=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-09.00.39.png\" alt=\"\" class=\"wp-image-178\" srcset=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-09.00.39.png 354w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-09.00.39-300x91.png 300w\" sizes=\"(max-width: 354px) 100vw, 354px\" \/><\/figure>\n\n\n\n<p>Select TV and choose your preferred resolution. Next&#8230;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"999\" height=\"678\" src=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-09.00.56.png\" alt=\"\" class=\"wp-image-179\" srcset=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-09.00.56.png 999w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-09.00.56-300x204.png 300w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-09.00.56-768x521.png 768w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-09.00.56-508x345.png 508w\" sizes=\"(max-width: 999px) 100vw, 999px\" \/><\/figure>\n\n\n\n<p>Choose a API Level. Next..<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"998\" height=\"678\" src=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-09.15.35.png\" alt=\"\" class=\"wp-image-180\" srcset=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-09.15.35.png 998w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-09.15.35-300x204.png 300w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-09.15.35-768x522.png 768w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-09.15.35-508x345.png 508w\" sizes=\"(max-width: 998px) 100vw, 998px\" \/><\/figure>\n\n\n\n<p>Now you can name the device however you like and make some advanced settings. I will leave it as it is \ud83d\ude0a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"995\" height=\"678\" src=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-09.16.32.png\" alt=\"\" class=\"wp-image-181\" srcset=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-09.16.32.png 995w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-09.16.32-300x204.png 300w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-09.16.32-768x523.png 768w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-09.16.32-508x346.png 508w\" sizes=\"(max-width: 995px) 100vw, 995px\" \/><\/figure>\n\n\n\n<p>Now you should be able to see the device in your list and run it. <\/p>\n\n\n\n<p>Here we go \ud83d\ude80<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"610\" src=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-09.21.41-1024x610.png\" alt=\"\" class=\"wp-image-184\" srcset=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-09.21.41-1024x610.png 1024w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-09.21.41-300x179.png 300w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-09.21.41-768x458.png 768w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-09.21.41-1536x915.png 1536w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-09.21.41-1240x739.png 1240w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-09.21.41-508x303.png 508w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-09.21.41.png 1948w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h4>Step 3: Create Main Activity &amp; Setup Project<\/h4>\n\n\n\n<p>Go to your package and create a new Java Class with the name <strong>MainActivity<\/strong>. I mean also here you can name it however you like \ud83d\ude0a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"766\" height=\"263\" src=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-09.58.52.png\" alt=\"\" class=\"wp-image-188\" srcset=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-09.58.52.png 766w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-09.58.52-300x103.png 300w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-09.58.52-508x174.png 508w\" sizes=\"(max-width: 766px) 100vw, 766px\" \/><\/figure>\n\n\n\n<p>As you can see I already added some stuff which are necessary for the <strong>MainActivity<\/strong> but we also need a layout for our app otherwise we can not start it. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"422\" height=\"242\" src=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-10.26.13.png\" alt=\"\" class=\"wp-image-189\" srcset=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-10.26.13.png 422w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-10.26.13-300x172.png 300w\" sizes=\"(max-width: 422px) 100vw, 422px\" \/><\/figure>\n\n\n\n<p>Create in the resource folder a new folder layout and add a new <strong>Layout Resource File<\/strong>. <\/p>\n\n\n\n<figure class=\"wp-block-gallery columns-1 is-cropped\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" width=\"723\" height=\"251\" src=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-10.02.40.png\" alt=\"\" data-id=\"191\" data-full-url=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-10.02.40.png\" data-link=\"http:\/\/filiz.it\/?attachment_id=191\" class=\"wp-image-191\" srcset=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-10.02.40.png 723w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-10.02.40-300x104.png 300w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-10.02.40-508x176.png 508w\" sizes=\"(max-width: 723px) 100vw, 723px\" \/><\/figure><\/li><\/ul><\/figure>\n\n\n\n<p>This is how my <strong>activity_main.xml <\/strong>looks like. I also added a blue background color so that I don&#8217;t have to look onto a black screen \ud83d\udda5\ufe0f<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;?<strong>xml version=\"1.0\" encoding=\"utf-8\"<\/strong>?>\n&lt;<strong>RelativeLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n android:background=\"#2980B9\"<\/strong>>\n\n&lt;\/<strong>RelativeLayout<\/strong>><\/pre>\n\n\n\n<p>And here the <strong>MainActivity<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>package <\/strong>com.example.webview;\n\n<strong>import <\/strong>android.app.Activity;\n<strong>import <\/strong>android.os.Bundle;\n\n<strong>public class <\/strong>MainActivity <strong>extends <\/strong>Activity {\n\n @Override\n <strong>public void <\/strong>onCreate(Bundle savedInstanceState) {\n  <strong>super<\/strong>.onCreate(savedInstanceState);\n  setContentView(R.layout.<strong><em>activity_main<\/em><\/strong>);\n }\n}<\/pre>\n\n\n\n<p>Now maybe you think that you can run the app,..sorry no \ud83d\udeab For this we need to update our <strong>AndroidManifest.xml<\/strong> to start our Activity. <\/p>\n\n\n\n<p>We need to define our start activity. I also add an icon for the app launcher . For this I created a drawable folder and put a Octocat into it..Lets see how this will look like..im afraid of the resolution \ud83e\udd7a<\/p>\n\n\n\n<p><strong>AndroidMainfest.xml<\/strong> looks now like this: <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong><em>&lt;?<\/em><strong>xml version=\"1.0\" encoding=\"utf-8\"<\/strong><em>?>\n<\/em>&lt;<strong>manifest xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\n xmlns:tools=\"http:\/\/schemas.android.com\/tools\"\n package=\"com.example.webview\"\n tools:ignore=\"MissingLeanbackLauncher\"<\/strong>>\n\n &lt;<strong>uses-feature\n  android:name=\"android.software.leanback\"\n  android:required=\"false\" <\/strong>\/>\n &lt;<strong>uses-feature\n  android:name=\"android.hardware.touchscreen\"\n  android:required=\"false\" <\/strong>\/>\n\n &lt;<strong>application\n  android:allowBackup=\"true\"\n  android:icon=\"<strong>@drawable\/stormtroopocat\"<\/strong>\n  android:label=\"@string\/app_name\"\n  android:supportsRtl=\"true\"\n  android:theme=\"@style\/Theme.WebView\" <\/strong>>\n\n  &lt;<strong>activity\n   android:name=\".MainActivity\"\n   android:banner=\"@drawable\/stormtroopocat\"\n   android:icon=\"@drawable\/stormtroopocat\"\n   android:label=\"@string\/app_name\"\n   android:logo=\"@drawable\/stormtroopocat\"\n   android:screenOrientation=\"landscape\"\n   tools:ignore=\"WrongManifestParent\"<\/strong>>\n &lt;<strong>intent-filter<\/strong>>\n &lt;<strong>action android:name=\"android.intent.action.MAIN\" <\/strong>\/>\n\n &lt;<strong>category android:name=\"android.intent.category.LAUNCHER\" <\/strong>\/>\n &lt;\/<strong>intent-filter<\/strong>>\n\n &lt;\/<strong>activity<\/strong>>\n&lt;\/<strong>application<\/strong>>\n\n&lt;\/<strong>manifest<\/strong>><\/strong><\/pre>\n\n\n\n<p>Here my drawable folder:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"310\" height=\"229\" src=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-12.03.06.png\" alt=\"\" class=\"wp-image-206\" srcset=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-12.03.06.png 310w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-12.03.06-300x222.png 300w\" sizes=\"(max-width: 310px) 100vw, 310px\" \/><\/figure>\n\n\n\n<p>Now its the time to run it \ud83d\udc4d<\/p>\n\n\n\n<p>Be sure your app and device you want to run is selected.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"381\" height=\"74\" src=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-11.54.22.png\" alt=\"\" class=\"wp-image-202\" srcset=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-11.54.22.png 381w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-11.54.22-300x58.png 300w\" sizes=\"(max-width: 381px) 100vw, 381px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"608\" src=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-11.55.45-1024x608.png\" alt=\"\" class=\"wp-image-203\" srcset=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-11.55.45-1024x608.png 1024w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-11.55.45-300x178.png 300w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-11.55.45-768x456.png 768w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-11.55.45-1536x912.png 1536w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-11.55.45-1240x736.png 1240w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-11.55.45-508x302.png 508w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-11.55.45.png 1954w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>And here our nice app icon..I like it \ud83d\ude0a <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"724\" height=\"184\" src=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-12.45.56.png\" alt=\"\" class=\"wp-image-212\" srcset=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-12.45.56.png 724w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-12.45.56-300x76.png 300w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-12.45.56-508x129.png 508w\" sizes=\"(max-width: 724px) 100vw, 724px\" \/><\/figure>\n\n\n\n<h4>Step 4: Add WebView<\/h4>\n\n\n\n<p>Now let\u00b4s add a webview and load some stuff into it. <\/p>\n\n\n\n<p>For this we have to update our layout and add a <strong>WebView<\/strong> component into it. <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong><em>&lt;?<\/em><strong>xml version=\"1.0\" encoding=\"utf-8\"<\/strong><em>?>\n<\/em>&lt;<strong>RelativeLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n android:background=\"#2980B9\"<\/strong>>\n\n &lt;<strong>WebView\n  android:id=\"@+id\/main_webview\"\n  android:layout_width=\"match_parent\"\n  android:layout_height=\"match_parent\" <\/strong>\/>\n\n&lt;\/<strong>RelativeLayout<\/strong>><\/strong><\/pre>\n\n\n\n<p>Next we have to update our MainActivity. Easy peasy \u270c\ufe0fWe just have to add the onResume function, initialize the WebView and load a url. <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>@Override\n<strong>protected void <\/strong>onResume() {\n <strong>super<\/strong>.onResume();\n WebView webView = findViewById(R.id.<strong>main_webview<\/strong>);\n webView.loadUrl(<strong>\"https:\/\/www.google.de\/\"<\/strong>);\n}<\/strong><\/pre>\n\n\n\n<p>Before we can run it we need to add internet permissions to our Manifest otherwise the Emulator is not allowed to access the internet. <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>&lt;<strong>uses-permission android:name=\"android.permission.INTERNET\" <\/strong>\/><\/strong><\/pre>\n\n\n\n<p>And here we go:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"607\" src=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-12.31.00-1024x607.png\" alt=\"\" class=\"wp-image-209\" srcset=\"http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-12.31.00-1024x607.png 1024w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-12.31.00-300x178.png 300w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-12.31.00-768x455.png 768w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-12.31.00-1536x911.png 1536w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-12.31.00-1240x735.png 1240w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-12.31.00-508x301.png 508w, http:\/\/filiz.it\/wp-content\/uploads\/2021\/02\/Bildschirmfoto-2021-02-25-um-12.31.00.png 1953w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Here the full code snippets of the <strong>MainActivity<\/strong> and <strong>AndroidManifest<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong><strong>package <\/strong>com.example.webview;\n\n<strong>import <\/strong>android.app.Activity;\n<strong>import <\/strong>android.os.Bundle;\n<strong>import <\/strong>android.webkit.WebView;\n\n<strong>public class <\/strong>MainActivity <strong>extends <\/strong>Activity {\n\n @Override\n <strong>public void <\/strong>onCreate(Bundle savedInstanceState) {\n  <strong>super<\/strong>.onCreate(savedInstanceState);\n  setContentView(R.layout.<strong><em>activity_main<\/em><\/strong>);\n }\n\n @Override\n <strong>protected void <\/strong>onResume() {\n  <strong>super<\/strong>.onResume();\n  WebView webView = findViewById(R.id.<strong><em>main_webview<\/em><\/strong>);\n  webView.loadUrl(<strong>\"https:\/\/www.google.de\/\"<\/strong>);\n }\n}<\/strong><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong><strong><em>&lt;?<\/em><strong>xml version=\"1.0\" encoding=\"utf-8\"<\/strong><em>?>\n<\/em>&lt;<strong>manifest xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\n xmlns:tools=\"http:\/\/schemas.android.com\/tools\"\n package=\"com.example.webview\"\n tools:ignore=\"MissingLeanbackLauncher\"<\/strong>>\n\n &lt;<strong>uses-permission android:name=\"android.permission.INTERNET\" <\/strong>\/>\n\n &lt;<strong>uses-feature\n  android:name=\"android.software.leanback\"\n  android:required=\"false\" <\/strong>\/>\n &lt;<strong>uses-feature\n  android:name=\"android.hardware.touchscreen\"\n  android:required=\"false\" <\/strong>\/>\n\n &lt;<strong>application\n  android:allowBackup=\"true\"\n  android:icon=\"@drawable\/stormtroopocat\"\n  android:label=\"@string\/app_name\"\n  android:supportsRtl=\"true\"\n  android:theme=\"@style\/Theme.WebView\"<\/strong>>\n\n  &lt;<strong>activity\n   android:name=\".MainActivity\"\n   android:banner=\"@drawable\/stormtroopocat\"\n   android:icon=\"@drawable\/stormtroopocat\"\n   android:label=\"@string\/app_name\"\n   android:logo=\"@drawable\/stormtroopocat\"\n   android:screenOrientation=\"landscape\"\n   tools:ignore=\"WrongManifestParent\"<\/strong>>\n  &lt;<strong>intent-filter<\/strong>>\n  &lt;<strong>action android:name=\"android.intent.action.MAIN\" <\/strong>\/>\n\n  &lt;<strong>category android:name=\"android.intent.category.LAUNCHER\" <\/strong>\/>\n  &lt;\/<strong>intent-filter<\/strong>>\n\n  &lt;\/<strong>activity<\/strong>>\n &lt;\/<strong>application<\/strong>>\n\n&lt;\/<strong>manifest<\/strong>><\/strong><\/strong><\/pre>\n\n\n\n<p>You can check out the code <a href=\"https:\/\/github.com\/FilHazer\/Android-TV-WebView\">here<\/a> .<\/p>\n\n\n\n<p>\ud83d\udc4b<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial I\u00b4m going to create an Android TV App where the main part consist of a WebView.\u00a0 Step 1: \u00a0Create a new Android TV App with Android Studio\u00a0 Be sure you have all necessary tools installed. Go to Android Studio File->New->New Project and select Blank Activity. Enter the name of the App, select [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":223,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/filiz.it\/index.php\/wp-json\/wp\/v2\/posts\/170"}],"collection":[{"href":"http:\/\/filiz.it\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/filiz.it\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/filiz.it\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/filiz.it\/index.php\/wp-json\/wp\/v2\/comments?post=170"}],"version-history":[{"count":28,"href":"http:\/\/filiz.it\/index.php\/wp-json\/wp\/v2\/posts\/170\/revisions"}],"predecessor-version":[{"id":222,"href":"http:\/\/filiz.it\/index.php\/wp-json\/wp\/v2\/posts\/170\/revisions\/222"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/filiz.it\/index.php\/wp-json\/wp\/v2\/media\/223"}],"wp:attachment":[{"href":"http:\/\/filiz.it\/index.php\/wp-json\/wp\/v2\/media?parent=170"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/filiz.it\/index.php\/wp-json\/wp\/v2\/categories?post=170"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/filiz.it\/index.php\/wp-json\/wp\/v2\/tags?post=170"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}