title: Webview with asynctask on Android
body: <p>i want to do it which the progress dialog waits the loading item on <strong>webview</strong>. How can i do it which <code>dialog.dismiss()</code> event depend on loading item on <strong>webview</strong>?</p>
  
  <pre><code>    public class asynctask extends  AsyncTask&lt;Void, Void, Void&gt; {
  
      private ProgressDialog dialog = new ProgressDialog(WebActivity.this);
  
  
    @Override
    protected void onPostExecute(Void result) {
        // TODO Auto-generated method stub
  </code></pre>
  
  <p><strong>in there how can i do it ??</strong></p>
  
  <pre><code>      dialog.dismiss();
  </code></pre>
  
  <p><strong>dialog disappear without waiting</strong></p>
  
  <pre><code>     }
   @Override 
   protected void onPreExecute() {
        // TODO Auto-generated method stub
          dialog.setMessage("Loading..Please wait.");
  
          dialog.show();
          dialog.setCanceledOnTouchOutside(false);
       }
  
  
  
  @Override
  protected Void doInBackground(Void... params) {
        // TODO Auto-generated method stub
  
  
  
  
        return null;
       }
  
  
   @Override
   public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
  
      setContentView(R.layout.webview);
  
      webView = (WebView) findViewById(R.id.webView1);
  
  
      Bundle extras = getIntent().getExtras();
      String url=extras.getString("adres");
  
      webView.setWebViewClient(new WebViewClient());
      webView.loadUrl(url);
  
  
  
      WebSettings webSettings = webView.getSettings();
      webSettings.setJavaScriptEnabled(true);
  
      new asynctask().execute();
  </code></pre>
  
  <p>}</p>