<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>android progressbar Archives -</title>
	<atom:link href="https://mitindia.in/tag/android-progressbar/feed/" rel="self" type="application/rss+xml" />
	<link>https://mitindia.in/tag/android-progressbar/</link>
	<description></description>
	<lastBuildDate>Sat, 26 Nov 2016 07:28:42 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://mitindia.in/wp-content/uploads/2023/03/cropped-android-chrome-512x512-1-32x32.png</url>
	<title>android progressbar Archives -</title>
	<link>https://mitindia.in/tag/android-progressbar/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Android example on webview with progressbar</title>
		<link>https://mitindia.in/android-example-on-webview-with-progressbar/</link>
					<comments>https://mitindia.in/android-example-on-webview-with-progressbar/#comments</comments>
		
		<dc:creator><![CDATA[SKB]]></dc:creator>
		<pubDate>Tue, 28 Jun 2016 06:23:46 +0000</pubDate>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[android progressbar]]></category>
		<guid isPermaLink="false">http://www.mitindia.in/?p=177</guid>

					<description><![CDATA[<p>The following example shows that use of android webview with progress bar. 1. copy the following code and paste into &#8220;AndroidManifest.xml&#8221; &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="app.mitindia.com.mywebappprogressbar" &#62; &#60;uses-permission android:name="android.permission.INTERNET" /&#62; &#60;application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &#62; &#60;activity android:name=".MainActivity" android:label="@string/app_name" &#62; &#60;intent-filter&#62; &#60;action android:name="android.intent.action.MAIN" /&#62; &#60;category android:name="android.intent.category.LAUNCHER" /&#62; &#60;/intent-filter&#62; &#60;/activity&#62; &#60;/application&#62; &#60;/manifest&#62; 2. Copy the [&#8230;]</p>
<p>The post <a href="https://mitindia.in/android-example-on-webview-with-progressbar/">Android example on webview with progressbar</a> appeared first on <a href="https://mitindia.in"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>The following example shows that use of android webview with progress bar.</p>
<p>1. copy the following code and paste into &#8220;AndroidManifest.xml&#8221;</p>
<pre>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="app.mitindia.com.mywebappprogressbar" &gt;
    &lt;uses-permission android:name="android.permission.INTERNET" /&gt;

    &lt;application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" &gt;
        &lt;activity
            android:name=".MainActivity"
            android:label="@string/app_name" &gt;
            &lt;intent-filter&gt;
                &lt;action android:name="android.intent.action.MAIN" /&gt;

                &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
            &lt;/intent-filter&gt;
        &lt;/activity&gt;
    &lt;/application&gt;

&lt;/manifest&gt;</pre>
<p>2. Copy the following code and paste into &#8220;activity_main.xml&#8221;</p>
<pre>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".WebViewActivity" &gt;

    &lt;LinearLayout
        android:id="@+id/urlContainer"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" &gt;

        &lt;EditText
            android:id="@+id/urlField"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="3"
            android:hint="Enter URL to open" /&gt;

        &lt;Button
            android:id="@+id/goButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Open" /&gt;
    &lt;/LinearLayout&gt;

    &lt;ProgressBar
        android:id="@+id/progressBar"
        android:layout_width="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_height="wrap_content"
        android:layout_below="@id/urlContainer" /&gt;

    &lt;WebView
        android:id="@+id/webView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_below="@id/progressBar" /&gt;

&lt;/RelativeLayout&gt;</pre>
<p>3. Copy the following and paste into &#8220;MainActivity.java&#8221;</p>
<pre>package app.mitindia.com.mywebappprogressbar;
import android.app.Activity;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;

public class MainActivity extends Activity {
    private WebView webView;
    private EditText urlEditText;
    private ProgressBar progress;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        urlEditText = (EditText) findViewById(R.id.urlField);
        webView = (WebView) findViewById(R.id.webView);
        webView.setWebViewClient(new MyWebViewClient());

        progress = (ProgressBar) findViewById(R.id.progressBar);
        progress.setVisibility(View.GONE);
        Button openUrl = (Button) findViewById(R.id.goButton);
        openUrl.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View view) {
                String url = urlEditText.getText().toString();
                if (validateUrl(url)) {
                    webView.getSettings().setJavaScriptEnabled(true);
                    webView.loadUrl(url);

                }
            }

            private boolean validateUrl(String url) {
                return true;
            }
        });

    }

    private class MyWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return true;
        }

        @Override
        public void onPageFinished(WebView view, String url) {
            progress.setVisibility(View.GONE);
            MainActivity.this.progress.setProgress(100);
            super.onPageFinished(view, url);
        }

        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            progress.setVisibility(View.VISIBLE);
            MainActivity.this.progress.setProgress(0);
            super.onPageStarted(view, url, favicon);
        }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    public void setValue(int progress) {
        this.progress.setProgress(progress);
    }
}</pre>
<p>4. Run the project and see the following output.</p>
<p><img fetchpriority="high" decoding="async" class="alignnone" src="http://2.bp.blogspot.com/-y11wCSWJ9aA/Voisdx3NCXI/AAAAAAAABCo/AFR3ztW8o7Q/s400/Screenshot_2016-01-03-09-36-53.png" width="225" height="400" /></p>
<p>&nbsp;</p>
<p><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fmitindia.in%2Fandroid-example-on-webview-with-progressbar%2F&amp;linkname=Android%20example%20on%20webview%20with%20progressbar" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fmitindia.in%2Fandroid-example-on-webview-with-progressbar%2F&amp;linkname=Android%20example%20on%20webview%20with%20progressbar" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fmitindia.in%2Fandroid-example-on-webview-with-progressbar%2F&#038;title=Android%20example%20on%20webview%20with%20progressbar" data-a2a-url="https://mitindia.in/android-example-on-webview-with-progressbar/" data-a2a-title="Android example on webview with progressbar"><img src="https://static.addtoany.com/buttons/favicon.png" alt="Share"></a></p><p>The post <a href="https://mitindia.in/android-example-on-webview-with-progressbar/">Android example on webview with progressbar</a> appeared first on <a href="https://mitindia.in"></a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://mitindia.in/android-example-on-webview-with-progressbar/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
