Ver Mensaje Individual
  #1  
Viejo 31/07/14, 00:26:44
Array

[xs_avatar]
kakashi20 kakashi20 no está en línea
Usuario novato en la web
 
Fecha de registro: jul 2014
Mensajes: 22
Tu operador: Movistar

Exclamation Colocar ProgressDialog en Webview de AlertAdialog

Estoy tratando de mostrar una WebView en AlertDialog y funciona perfecto, pero también trato de poner un ProgressDialog que dice "Loading" cuando la dirección URL de la WebView se está cargando.

El problema es que el ProgressDialog no aparece pero sí muestra la URL al cargar el WebView.

Alguna ayuda?

Gracias


Código:
@Override
            protected void onPostExecute(String result) {

                    //Toast.makeText(context, result.toString(), Toast.LENGTH_LONG).show();
                    /*nombre.setText("");
                    dni.setText("");
                    telefono.setText("");
                    email.setText("");*/



                AlertDialog.Builder alert = new AlertDialog.Builder(getActivity()); 
                alert.setTitle("Title here");


                // Para colocar un loading

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

                //--------------------------

                WebView wv = new WebView(getActivity());
                wv.loadUrl("http:\\www.google.com");
                wv.setWebViewClient(new WebViewClient() {

                    public void onPageFinished(WebView view, String url) {
                        if(pd.isShowing()&&pd!=null)
                        {
                            pd.dismiss();
                        }
                    }


                    @Override
                    public boolean shouldOverrideUrlLoading(WebView view, String url) {
                        view.loadUrl(url);

                        return true;
                    }
                });

                alert.setView(wv);
                alert.setNegativeButton("Close", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int id) {
                        dialog.dismiss();
                    }
                });
                alert.show();




            }
Responder Con Cita