How to run progressDialog inside WebView ?

by teeming » Sat, 24 Apr 2010 01:48:37 GMT

Sponsored Links

I am new to android development. I wanted to create an app that
displaying a progressDialog when loading the webpage using
webview.loadurl. However i couldn't make my code run. The app is
loaded with error in the emulator. Below is my code. Hope anybody can
help me trace the problem. Thanks.

package hello.WebView;

import android.view.KeyEvent;
import android.webkit.*;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;

public class HelloWebView extends Activity implements Runnable {

        WebView webview;
        private ProgressDialog pd;
    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {


        public boolean onKeyDown(int keyCode, KeyEvent event) {

                pd =, "", "Loading...", true,

                Thread thread = new Thread(this);

                return super.onKeyDown(keyCode, event);

        public void run() {

                webview.loadUrl(" ");

        private Handler handler = new Handler() {
                public void handleMessage(Message msg) {




How to run progressDialog inside WebView ?

by Kumar Bibek » Mon, 26 Apr 2010 13:39:48 GMT

 You can put a progressbar inside a WebView and set or unset it's
visibility. That should solve your problem.

Thanks and Regards,
Kumar Bibek


Sponsored Links

Other Threads

1. Is there a way to determine which carrier the phone is using?

Is there a way to determine which carrier the phone is using.  T-
Mobile, Spring, AT&T, etc?

2. Deadlock in GLSurfaceView

We are developing an application that uses a GLSurfaceView to display
3D objects. We regularly get the "Application Not Responding" dialog.
Inspection of the dumped threads reveals something that looks
suspiciously like a deadlock. I have added the three thread dumps
involved below.

The first thread is the main application event thread, and it is
waiting on a join with a GLThread.

The second thread is a brand new GLThread that is waiting for a
semaphore lock presumably so it knows it has exclusive access to the
graphics hardware.

The third thread is probably a previous GLThread (the one the main
thread is waiting for to finish), that is waiting to be notified. The
strange thing is that the main application thread has just done a
"mDone=true; notify();" prior to calling "wait()", so the third thread
should have been awaken?

- Has anyone else run into this issue?
- Does anyone know of a workaround?

Any help would be appreciated!

"main" prio=5 tid=3 WAIT
  | group="main" sCount=1 dsCount=0 s=0 obj=0x40018e70
  | sysTid=713 nice=0 sched=0/0 handle=-1093387108
  at java.lang.Object.wait(Native Method)
  - waiting on <0x2976e0> (a java.lang.VMThread)
  at java.lang.Thread.join(
  at java.lang.Thread.join(
  at android.opengl.GLSurfaceView$GLThread.requestExitAndWait
  at android.opengl.GLSurfaceView.onDetachedFromWindow
  at android.view.View.dispatchDetachedFromWindow(

"GLThread" prio=5 tid=23 WAIT
  | group="main" sCount=1 dsCount=0 s=0 obj=0x43516a80
  | sysTid=1188 nice=0 sched=0/0 handle=3235208
  at java.lang.Object.wait(Native Method)
  - waiting on <0x2976e0> (a java.lang.VMThread)
  at java.lang.Thread.parkFor(
  at java.lang.LangAccessImpl.parkFor(
  at sun.misc.Unsafe.park(
  at java.util.concurrent.locks.LockSupport.park(
  at java.util.concurrent.Semaphore.acquire(
  at android.opengl.GLSurfaceView$

"GLThread" prio=5 tid=19 WAIT
  | group="main" sCount=1 dsCount=0 s=0 obj=0x435e4098
  | sysTid=1184 nice=0 sched=0/0 handle=4061600
  at java.lang.Object.wait(Native Method)
  - waiting on <0x1c74b8> (a android.opengl.GLSurfaceView$GLThread)
  at java.lang.Object.wait(
  at android.opengl.GLSurfaceView$GLThread.guardedRun
  at android.opengl.GLSurfaceView$


3. Droid Wall - Android Firewall

4. video screen disappeared after launch new task

5. H264 codec

6. ANN: Facebook Connect library for Android

7. Did Android support make a dial in native code