{"id":1869,"date":"2013-01-21T22:12:26","date_gmt":"2013-01-21T20:12:26","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=1869"},"modified":"2013-01-30T19:00:25","modified_gmt":"2013-01-30T17:00:25","slug":"android-webview-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/webview\/android-webview-example\/","title":{"rendered":"Android WebView Example"},"content":{"rendered":"<p>In Android, you can use the\u00a0<a href=\"http:\/\/developer.android.com\/reference\/android\/webkit\/WebView.html\" target=\"_blank\">WebView<\/a>\u00a0component in order to present markup pages from\u00a0URL or custom html markup page (short of like a browser, but in your own application&#8230;). In this tutorial we are going to create an use two Activities. The main Activity will contain a button. When the user presses that button, another activity launches which will contain a web view and will present the Home Page of JavaCodeGeeks.<\/p>\n<p>For this tutorial, we will use the following tools in a Windows 64-bit platform:<\/p>\n<ol>\n<li>JDK 1.7<\/li>\n<li>Eclipse 4.2 Juno<\/li>\n<li>Android SKD 4.2<\/li>\n<\/ol>\n<h3>1. Create a new Android Project<\/h3>\n<p>Open Eclipse IDE and go to File -&gt; New -&gt; Project -&gt; Android -&gt; Android Application Project and click Next.<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/create-new-project6.jpg\"><img decoding=\"async\" title=\"create-new-project\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/create-new-project6.jpg\" alt=\"\" width=\"467\" height=\"460\" \/><\/a><\/p>\n<p>You have to specify the Application Name, the Project Name and the Package name in the appropriate text fields and then click Next.<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/create-new-project-attributes7.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1870\" title=\"create-new-project-attributes\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/create-new-project-attributes7.jpg\" alt=\"\" width=\"591\" height=\"433\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/create-new-project-attributes7.jpg 591w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/create-new-project-attributes7-300x219.jpg 300w\" sizes=\"(max-width: 591px) 100vw, 591px\" \/><\/a><\/p>\n<p>In the next window make sure the \u201cCreate activity\u201d option is selected in order to create a new activity for your project, and click Next. This is optional as you can create a new activity after creating the project, but you can do it all in one step.<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/check-create-new-activity14.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1871\" title=\"check-create-new-activity\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/check-create-new-activity14.jpg\" alt=\"\" width=\"578\" height=\"482\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/check-create-new-activity14.jpg 578w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/check-create-new-activity14-300x250.jpg 300w\" sizes=\"(max-width: 578px) 100vw, 578px\" \/><\/a><\/p>\n<p>Select \u201cBlankActivity\u201d and click Next.<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/create-blanc-activity.jpg\"><img decoding=\"async\" title=\"create-blanc-activity\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/create-blanc-activity.jpg\" alt=\"\" width=\"535\" height=\"485\" \/><\/a><\/p>\n<p>You will be asked to specify some information about the new activity. \u00a0In the Layout Name text field you have to specify the name of the file that will contain the layout description of your app. In our case the file\u00a0<code>res\/layout\/main.xml<\/code>\u00a0will be created. Then, click Finish.<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/create-new-activity-attributes3.jpg\"><img decoding=\"async\" title=\"create-new-activity-attributes\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/create-new-activity-attributes3.jpg\" alt=\"\" width=\"625\" height=\"452\" \/><\/a><\/p>\n<h3>2. Create the Layout of the main Activity<\/h3>\n<p>Open\u00a0<code>res\/layout\/main.xml<\/code>\u00a0file :<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/package-explorer-main-layout2.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1872\" title=\"package-explorer-main-layout\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/package-explorer-main-layout2.jpg\" alt=\"\" width=\"361\" height=\"474\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/package-explorer-main-layout2.jpg 361w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/package-explorer-main-layout2-228x300.jpg 228w\" sizes=\"(max-width: 361px) 100vw, 361px\" \/><\/a><\/p>\n<p>And paste the following code :<\/p>\n<pre class=\"brush:xml\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;LinearLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n    android:layout_width=\"fill_parent\"\r\n    android:layout_height=\"fill_parent\"\r\n    android:orientation=\"vertical\" &gt;\r\n\r\n    &lt;Button\r\n        android:id=\"@+id\/buttonUrl\"\r\n        android:layout_width=\"wrap_content\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:text=\"JavaCodeGeeks Home Page\" \/&gt;\r\n\r\n&lt;\/LinearLayout&gt;<\/pre>\n<p>Now you may open the Graphical layout editor to preview the User Interface you created:<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/graphical-layout-editor10.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1873\" title=\"graphical-layout-editor\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/graphical-layout-editor10.jpg\" alt=\"\" width=\"504\" height=\"635\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/graphical-layout-editor10.jpg 504w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/graphical-layout-editor10-238x300.jpg 238w\" sizes=\"(max-width: 504px) 100vw, 504px\" \/><\/a><\/p>\n<h3>3. Create a new Activity<\/h3>\n<p>Go to the Package Explorer and right click on the package (in our case com.javacodegeeks.android.androidwebviewexample). Select New -&gt; Class. Put the\u00a0appropriate\u00a0attributes as shown in the\u00a0picture\u00a0below:<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/create-new-activity.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1884\" title=\"create-new-activity\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/create-new-activity.jpg\" alt=\"\" width=\"544\" height=\"627\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/create-new-activity.jpg 544w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/create-new-activity-260x300.jpg 260w\" sizes=\"(max-width: 544px) 100vw, 544px\" \/><\/a><\/p>\n<p>As you will see a new java file has been created:<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/package-explorer-source-files.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1874\" title=\"package-explorer-source-files\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/package-explorer-source-files.jpg\" alt=\"\" width=\"430\" height=\"322\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/package-explorer-source-files.jpg 430w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/package-explorer-source-files-300x224.jpg 300w\" sizes=\"(max-width: 430px) 100vw, 430px\" \/><\/a><\/p>\n<h3>4. Create the Layout of the new activity<\/h3>\n<p>To create a new layout file, go to the Package Explorer and right click on the\u00a0<code>res\/layout\u00a0<\/code>folder. Select New -&gt; Other -&gt; Android -&gt; Android XML Layout File. And click Next:<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/new-layout-xml-file.jpg\"><img decoding=\"async\" title=\"new-layout-xml-file\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/new-layout-xml-file.jpg\" alt=\"\" width=\"517\" height=\"493\" \/><\/a><\/p>\n<p>Then specify the name of the file and the Layout type and click Finish:<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/new-xml-layout-file.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1875\" title=\"new-xml-layout-file\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/new-xml-layout-file.jpg\" alt=\"\" width=\"472\" height=\"449\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/new-xml-layout-file.jpg 472w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/new-xml-layout-file-300x285.jpg 300w\" sizes=\"(max-width: 472px) 100vw, 472px\" \/><\/a><\/p>\n<p>As you will see in the Package Explorer the new\u00a0<code>\/res\/layout\/webcontent.xml<\/code>\u00a0file has been created:<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/webcontent.xml_.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1876\" title=\"webcontent.xml\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/webcontent.xml_.jpg\" alt=\"\" width=\"349\" height=\"474\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/webcontent.xml_.jpg 349w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/webcontent.xml_-220x300.jpg 220w\" sizes=\"(max-width: 349px) 100vw, 349px\" \/><\/a><\/p>\n<p>Open that file and paste the following code:<\/p>\n<pre class=\"brush:xml\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;WebView xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n    android:id=\"@+id\/webView\"\r\n    android:layout_width=\"fill_parent\"\r\n    android:layout_height=\"fill_parent\" \/&gt;<\/pre>\n<h3>5. Code<\/h3>\n<p>Open <code>WebActivity.java<\/code> and paste the following code:<\/p>\n<pre class=\"brush:java\">package com.javacodegeeks.android.androidwebviewexample;\r\n\r\nimport android.app.Activity;\r\nimport android.os.Bundle;\r\nimport android.webkit.WebView;\r\n\r\npublic class WebActivity extends Activity {\r\n\r\n\tprivate WebView webView;\r\n\r\n\tpublic void onCreate(Bundle savedInstanceState) {\r\n\r\n\t\tsuper.onCreate(savedInstanceState);\r\n\t\tsetContentView(R.layout.webcontent);\r\n\r\n\t\twebView = (WebView) findViewById(R.id.webView);\r\n\r\n\t\twebView.getSettings().setJavaScriptEnabled(true);\r\n\r\n\t\twebView.loadUrl(\"http:\/\/www.javacodegeeks.com\");\r\n\r\n\t\t\/\/String customHtml = \"&lt;html&gt;&lt;body&gt;&lt;h2&gt;Greetings from JavaCodeGeeks&lt;\/h2&gt;&lt;\/body&gt;&lt;\/html&gt;\";\r\n\t\t\/\/webView.loadData(customHtml, \"text\/html\", \"UTF-8\");\r\n\r\n\t}\r\n\r\n}<\/pre>\n<p>Open <code>MainActivity.java<\/code>and paste the following code:<\/p>\n<pre class=\"brush:java\">package com.javacodegeeks.android.androidwebviewexample;\r\n\r\nimport android.app.Activity;\r\nimport android.content.Context;\r\nimport android.content.Intent;\r\nimport android.os.Bundle;\r\nimport android.view.View;\r\nimport android.view.View.OnClickListener;\r\nimport android.widget.Button;\r\n\r\npublic class MainActivity extends Activity {\r\n\r\n\tprivate Button button;\r\n\r\n\tpublic void onCreate(Bundle savedInstanceState) {\r\n\t\tfinal Context context = this;\r\n\r\n\t\tsuper.onCreate(savedInstanceState);\r\n\t\tsetContentView(R.layout.main);\r\n\r\n\t\tbutton = (Button) findViewById(R.id.buttonUrl);\r\n\r\n\t\tbutton.setOnClickListener(new OnClickListener() {\r\n\r\n\t\t  @Override\r\n\t\t  public void onClick(View arg0) {\r\n\t\t    Intent intent = new Intent(context, WebActivity.class);\r\n\t\t    startActivity(intent);\r\n\t\t  }\r\n\r\n\t\t});\r\n\t}\r\n}<\/pre>\n<h3>6. Edit <code>AndroidManifest.xml<\/code><\/h3>\n<p>When you want to display Internet content in your Application you need to set the appropriate permissions in your <code>AndroidManifest.xml<\/code>. You can do this by adding the followint line in <code>AndroidManifest.xml<\/code>:<\/p>\n<pre class=\"brush:xml\">&lt;uses-permission android:name=\"android.permission.INTERNET\" \/&gt;<\/pre>\n<p>We also need to declare our new Activity. So, open <code>AndroidManifest.xml<\/code>:<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/android-manifest.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1879\" title=\"android-manifest\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/android-manifest.jpg\" alt=\"\" width=\"494\" height=\"304\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/android-manifest.jpg 494w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/android-manifest-300x184.jpg 300w\" sizes=\"(max-width: 494px) 100vw, 494px\" \/><\/a><\/p>\n<p>And paste the following code:<\/p>\n<pre class=\"brush:xml\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;manifest xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n    package=\"com.javacodegeeks.android.androidwebviewexample\"\r\n    android:versionCode=\"1\"\r\n    android:versionName=\"1.0\" &gt;\r\n\r\n    &lt;uses-sdk android:minSdkVersion=\"8\" android:targetSdkVersion=\"16\" \/&gt;\r\n\r\n    &lt;uses-permission android:name=\"android.permission.INTERNET\" \/&gt;\r\n\r\n    &lt;application\r\n        android:allowBackup=\"true\"\r\n        android:icon=\"@drawable\/ic_launcher\"\r\n        android:label=\"@string\/app_name\"\r\n        android:theme=\"@style\/AppTheme\" &gt;\r\n        &lt;activity\r\n            android:name=\".WebActivity\"\r\n            android:theme=\"@android:style\/Theme.NoTitleBar\" \/&gt;\r\n\r\n        &lt;activity\r\n            android:name=\"com.javacodegeeks.android.androidwebviewexample.MainActivity\"\r\n            android:label=\"@string\/app_name\" &gt;\r\n            &lt;intent-filter&gt;\r\n                &lt;action android:name=\"android.intent.action.MAIN\" \/&gt;\r\n\r\n                &lt;category android:name=\"android.intent.category.LAUNCHER\" \/&gt;\r\n            &lt;\/intent-filter&gt;\r\n        &lt;\/activity&gt;\r\n    &lt;\/application&gt;\r\n\r\n&lt;\/manifest&gt;<\/pre>\n<h3>7. Run the application<\/h3>\n<p>This is the main screen of our Application<span style=\"font-family: monospace;\">:<\/span><\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/main-screen14.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1877\" title=\"main-screen\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/main-screen14.jpg\" alt=\"\" width=\"256\" height=\"470\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/main-screen14.jpg 256w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/main-screen14-163x300.jpg 163w\" sizes=\"(max-width: 256px) 100vw, 256px\" \/><\/a><\/p>\n<p>Now, when you press the button:<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/jcg-home-page.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1878\" title=\"jcg-home-page\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/jcg-home-page.jpg\" alt=\"\" width=\"256\" height=\"470\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/jcg-home-page.jpg 256w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/jcg-home-page-163x300.jpg 163w\" sizes=\"(max-width: 256px) 100vw, 256px\" \/><\/a><\/p>\n<h3>8. Load custom markup<\/h3>\n<p>Open <code>WebActivity.java<\/code> and un-comment the last two lines:<\/p>\n<pre class=\"brush:java\">package com.javacodegeeks.android.androidwebviewexample;\r\n\r\nimport android.app.Activity;\r\nimport android.os.Bundle;\r\nimport android.webkit.WebView;\r\n\r\npublic class WebActivity extends Activity {\r\n\r\n\tprivate WebView webView;\r\n\r\n\tpublic void onCreate(Bundle savedInstanceState) {\r\n\r\n\t\tsuper.onCreate(savedInstanceState);\r\n\t\tsetContentView(R.layout.webcontent);\r\n\r\n\t\twebView = (WebView) findViewById(R.id.webView);\r\n\r\n\t\twebView.getSettings().setJavaScriptEnabled(true);\r\n\r\n\t\t\/\/webView.loadUrl(\"http:\/\/www.javacodegeeks.com\");\r\n\r\n\t\tString customHtml = \"&lt;html&gt;&lt;body&gt;&lt;h2&gt;Greetings from JavaCodeGeeks&lt;\/h2&gt;&lt;\/body&gt;&lt;\/html&gt;\";\r\n\t\twebView.loadData(customHtml, \"text\/html\", \"UTF-8\");\r\n\r\n\t}\r\n\r\n}<\/pre>\n<h3>9. Run the application<\/h3>\n<p>Now, when you press the button on the main sceen:<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/load-markup-example.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1880\" title=\"load-markup-example\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/load-markup-example.jpg\" alt=\"\" width=\"256\" height=\"470\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/load-markup-example.jpg 256w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/load-markup-example-163x300.jpg 163w\" sizes=\"(max-width: 256px) 100vw, 256px\" \/><\/a><\/p>\n<h3>Download Eclipse Project<\/h3>\n<p>This was an Android WebView Example. Download the Eclipse Project of this tutorial:\u00a0<a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/AndroidWebViewExample.zip\">AndroidWebViewExample.zip<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Android, you can use the\u00a0WebView\u00a0component in order to present markup pages from\u00a0URL or custom html markup page (short of like a browser, but in your own application&#8230;). In this tutorial we are going to create an use two Activities. The main Activity will contain a button. When the user presses that button, another activity &hellip;<\/p>\n","protected":false},"author":6,"featured_media":1202,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[307],"tags":[265,267,293],"class_list":["post-1869","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-webview","tag-android-core","tag-android-ui","tag-android-webview"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Android WebView Example<\/title>\n<meta name=\"description\" content=\"In Android, you can use the\u00a0WebView\u00a0component in order to present markup pages from\u00a0URL or custom html markup page (short of like a browser, but in your\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/webview\/android-webview-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android WebView Example\" \/>\n<meta property=\"og:description\" content=\"In Android, you can use the\u00a0WebView\u00a0component in order to present markup pages from\u00a0URL or custom html markup page (short of like a browser, but in your\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/webview\/android-webview-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2013-01-21T20:12:26+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-01-30T17:00:25+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Byron Kiourtzoglou\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Byron Kiourtzoglou\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/webview\/android-webview-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/webview\/android-webview-example\/\"},\"author\":{\"name\":\"Byron Kiourtzoglou\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/3b111ec1048740c68c9e709ff6240015\"},\"headline\":\"Android WebView Example\",\"datePublished\":\"2013-01-21T20:12:26+00:00\",\"dateModified\":\"2013-01-30T17:00:25+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/webview\/android-webview-example\/\"},\"wordCount\":517,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/webview\/android-webview-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"keywords\":[\"Android Core\",\"Android UI\",\"Android WebView\"],\"articleSection\":[\"WebView\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/webview\/android-webview-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/webview\/android-webview-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/webview\/android-webview-example\/\",\"name\":\"Android WebView Example\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/webview\/android-webview-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/webview\/android-webview-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"datePublished\":\"2013-01-21T20:12:26+00:00\",\"dateModified\":\"2013-01-30T17:00:25+00:00\",\"description\":\"In Android, you can use the\u00a0WebView\u00a0component in order to present markup pages from\u00a0URL or custom html markup page (short of like a browser, but in your\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/webview\/android-webview-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/webview\/android-webview-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/webview\/android-webview-example\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/webview\/android-webview-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Android\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/android\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"core\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"ui\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/ui\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"WebView\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/ui\/webview\/\"},{\"@type\":\"ListItem\",\"position\":6,\"name\":\"Android WebView Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/3b111ec1048740c68c9e709ff6240015\",\"name\":\"Byron Kiourtzoglou\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/10\/Byron-Kiourtzoglou-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/10\/Byron-Kiourtzoglou-96x96.jpg\",\"caption\":\"Byron Kiourtzoglou\"},\"description\":\"Byron is a master software engineer working in the IT and Telecom domains. He is an applications developer in a wide variety of applications\/services. He is currently acting as the team leader and technical architect for a proprietary service creation and integration platform for both the IT and Telecom industries in addition to a in-house big data real-time analytics solution. He is always fascinated by SOA, middleware services and mobile development. Byron is co-founder and Executive Editor at Java Code Geeks.\",\"sameAs\":[\"https:\/\/www.pivotalgamers.com\/\",\"https:\/\/www.linkedin.com\/in\/byron-kiourtzoglou-530ab222\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/byron-kiourtzoglou\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Android WebView Example","description":"In Android, you can use the\u00a0WebView\u00a0component in order to present markup pages from\u00a0URL or custom html markup page (short of like a browser, but in your","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/webview\/android-webview-example\/","og_locale":"en_US","og_type":"article","og_title":"Android WebView Example","og_description":"In Android, you can use the\u00a0WebView\u00a0component in order to present markup pages from\u00a0URL or custom html markup page (short of like a browser, but in your","og_url":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/webview\/android-webview-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2013-01-21T20:12:26+00:00","article_modified_time":"2013-01-30T17:00:25+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","type":"image\/jpeg"}],"author":"Byron Kiourtzoglou","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Byron Kiourtzoglou","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/webview\/android-webview-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/webview\/android-webview-example\/"},"author":{"name":"Byron Kiourtzoglou","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/3b111ec1048740c68c9e709ff6240015"},"headline":"Android WebView Example","datePublished":"2013-01-21T20:12:26+00:00","dateModified":"2013-01-30T17:00:25+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/webview\/android-webview-example\/"},"wordCount":517,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/webview\/android-webview-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","keywords":["Android Core","Android UI","Android WebView"],"articleSection":["WebView"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/webview\/android-webview-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/webview\/android-webview-example\/","url":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/webview\/android-webview-example\/","name":"Android WebView Example","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/webview\/android-webview-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/webview\/android-webview-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","datePublished":"2013-01-21T20:12:26+00:00","dateModified":"2013-01-30T17:00:25+00:00","description":"In Android, you can use the\u00a0WebView\u00a0component in order to present markup pages from\u00a0URL or custom html markup page (short of like a browser, but in your","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/webview\/android-webview-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/webview\/android-webview-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/webview\/android-webview-example\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/webview\/android-webview-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Android","item":"https:\/\/examples.javacodegeeks.com\/category\/android\/"},{"@type":"ListItem","position":3,"name":"core","item":"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/"},{"@type":"ListItem","position":4,"name":"ui","item":"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/ui\/"},{"@type":"ListItem","position":5,"name":"WebView","item":"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/ui\/webview\/"},{"@type":"ListItem","position":6,"name":"Android WebView Example"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/3b111ec1048740c68c9e709ff6240015","name":"Byron Kiourtzoglou","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/10\/Byron-Kiourtzoglou-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/10\/Byron-Kiourtzoglou-96x96.jpg","caption":"Byron Kiourtzoglou"},"description":"Byron is a master software engineer working in the IT and Telecom domains. He is an applications developer in a wide variety of applications\/services. He is currently acting as the team leader and technical architect for a proprietary service creation and integration platform for both the IT and Telecom industries in addition to a in-house big data real-time analytics solution. He is always fascinated by SOA, middleware services and mobile development. Byron is co-founder and Executive Editor at Java Code Geeks.","sameAs":["https:\/\/www.pivotalgamers.com\/","https:\/\/www.linkedin.com\/in\/byron-kiourtzoglou-530ab222"],"url":"https:\/\/examples.javacodegeeks.com\/author\/byron-kiourtzoglou\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/1869","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=1869"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/1869\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/1202"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=1869"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=1869"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=1869"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}