vivek
vivek

Reputation: 4919

Display Progress Bar until the response comes from server

I want to display some text from server, but till then I want to display Progress Bar. Can anyone help me out. Response is in the form of JSON

Upvotes: 2

Views: 1797

Answers (2)

Bradley Uffner
Bradley Uffner

Reputation: 16991

I've used AsyncTask to do this before. Make the progress dialog display in onPreExecute, and dismiss it in onPostExecute. Works very nicely, and it's nice and clean.

http://javatech.org/2011/02/discovering-android-opening-a-progress-dialog-with-asynctask/

Upvotes: 1

xDragonZ
xDragonZ

Reputation: 12662

how about this?

Add a Progress Bar in WebView

http://www.firstdroid.com/2010/08/04/adding-progress-bar-on-webview-android-tutorials/

final ProgressDialog pd = ProgressDialog.show(this, "", "Please Wait",
            true);


    final WebView engine = (WebView) findViewById(R.id.webview);
    engine.setWebViewClient(new WebViewClient() {

        @Override
        public void onPageFinished(WebView view, String url) {

            if (pd.isShowing() && pd != null) {
                pd.dismiss();
            }
        }
    });
    engine.loadUrl("http://www.domain.com/");

Upvotes: 4

Related Questions