How to run progressDialog inside WebView ?

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


Sponsored Links
 Hi,

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.app.Activity;
import android.app.ProgressDialog;
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. */
    @Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
    }

        @Override
        public boolean onKeyDown(int keyCode, KeyEvent event) {

                pd = ProgressDialog.show(this, "", "Loading...", true,
                                false);

                Thread thread = new Thread(this);
                thread.start();

                return super.onKeyDown(keyCode, event);
        }

        public void run() {

                webview.loadUrl(" http://m.adoimagazine.com ");
                setContentView(webview);
                handler.sendEmptyMessage(0);


        }
        private Handler handler = new Handler() {
                @Override
                public void handleMessage(Message msg) {
                        pd.dismiss();

                }
        };

    }

--



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. How to stop the device from sleeping

Hi,

I released a "Hypnotic Spiral" demo on the market yesterday. One of
the most requested features from the comments I've received is to stop
the phone from sleeping after a few minutes of no use. Is there a way
to deep the phone awake while my activity is running?

Thanks,
Mike
--~--~---------~--~----~------------~-------~--~----~

2. How to and new browser plugin

Hi,

I want to add a new browser plugin and i can see there is a plugin present
with
names gears.so in Browser/assets/plugins folder and some html files inside
gears-04.23.0 folder .
I had created a plugin by using Netscape Plugin functionality and i had
build plugin.so file .
I am not sure what to do next .

For testing purpose i had put my plugin.so file in "Browser/assets/plugins"
path name so
that the Browser.apk will have my plugin.so file but that did not worked .
I think plug in should work if i can reflect my plugin.so file in
"data/data/com.android.browser/app_plugins" .

Can someone guide me what to do next .
Hope to see some positive response.

Thanks,
Ashok.

--~--~---------~--~----~------------~-------~--~----~

3. Usbnet on android

4. WebView/Browser: How to browse files from the sdcard?

5. OpengGL ES Mouse/Touch Events

6. Concern about application file size for publishing due to Media files

7. Animation image