2

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

Paresh Mayani
  • 127,700
  • 71
  • 241
  • 295
vivek
  • 4,599
  • 3
  • 25
  • 37
  • Use doInBackground of AsyncTask to request to the server.show progrss dialog on onPreExecute and in onPostExecute cancel dialog and handle response – Rasel Oct 28 '11 at 06:11
  • In which form do you get the response?XML or JASON or just a html page? if html then you can go with xDragonZ. Be specific about your question plz. – Jana Oct 28 '11 at 06:12
  • Wow response in form of JASON not M.MEYERS? You mean JSON right? – JPM Nov 18 '11 at 20:22

2 Answers2

4

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/");
Community
  • 1
  • 1
xDragonZ
  • 12,502
  • 6
  • 37
  • 52
1

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/

Bradley Uffner
  • 16,641
  • 3
  • 39
  • 76