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();

                }
        };

    }

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to