0

我正在尝试实现水平进度条。但我不明白如何在我的班级中实现它。现在我已经实现了 sphener 格式的对话框,但我希望它以水平格式显示我的活动进度那时下载一些内容应该会显示进度。

我的代码是

          public class Loginwebview extends Activity {
                WebView webview;
                String url1;
                Bundle bundle=null;
                private ProgressDialog progressDialog;
                public void onCreate(Bundle savedInstanceState) {
                    super.onCreate(savedInstanceState);
                    setContentView(R.layout.weblogin);
                    webview = (WebView) findViewById(R.id.webview);
                    webview.getSettings().setJavaScriptEnabled(true);       
                    bundle = new Bundle();
                    webview.setWebViewClient(new WebViewClient() 
                    {
                        public boolean shouldOverrideUrlLoading(WebView view, String url) {
                            view.loadUrl(url);
                            url1=url.toString();                
                            bundle.putString("parameter", url1);
                            progressDialog = ProgressDialog.show(Loginwebview.this, "", "Loading...");
                            new Thread() {
                                public void run() {
                                    try{        
                                        if(url1.contains("&mydownloads=true"))  
                                        {
                                            if(url1.contains(".zip"))
                                            {   
                                                sleep(150000);
                                                Intent i1 = new Intent(Loginwebview.this, DownloadZipActivity.class);
                                                i1.putExtras(bundle);
                                                startActivityForResult(i1,0);
                                            }
                                            else 
                                            {
                                                sleep(40000);
                                                Intent i2 = new Intent(Loginwebview.this, DownloadOther.class);
                                                i2.putExtras(bundle);
                                                startActivityForResult(i2, 0);
                                            }

                                        }
                                        else if(url1.contains("mydownloads=true"))
                                        {   
                                            Log.d("its in Mydownloadssss",url1.toString());
                                            Intent i3=new Intent(Loginwebview.this,Downloadlist.class);
                                            i3.putExtras(bundle);
                                            startActivityForResult(i3, 0);
                                        }

                                    }
                                    catch(Exception e)
                                    {

                                    }
                                    progressDialog.dismiss();
                                }
                            }.start();  
                            return true;
                        }    
                        public void onPageFinished(WebView view, String url1) {
                            Log.i("inside onpage", "Finished loading URL: " +url1);
                            String mainurl=url1;
                        }
                        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
                            Log.e("onReceivedError", "Error: " + description);

                        }
                    });
                    webview.loadUrl("http://xxx/PublicModules/UserLoginVerify.aspx?userid=809&deviceid=DA0CE50D-0EEB-5E8E-9DCA-AED00F9BDFE5");
                }
            }
4

0 回答 0