title: How to return Void function doInBackground in AsynTask?
body: <p>how to get the result of the function void in asyntask
  I've tried like this but the application always stops</p>
  
  <p>I want to implement a progressbar in webview with asyntask when the waiting process</p>
  
  <p>note: I've read this <a href="https://stackoverflow.com/questions/14122089/webview-with-asynctask-on-android">Webview with asynctask on Android</a></p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
      EditText edInput;
      Button btnCari;
      WebView webView;
      public String dataUrl;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          initUI();
          initEvent();
          new asynCaller().execute();
      }
  
  
      private void initUI(){
          edInput = (EditText) findViewById(R.id.editText);
          dataUrl = edInput.getText().toString();
          btnCari = (Button) findViewById(R.id.button);
          webView = (WebView) findViewById(R.id.webview);
      }
  
      private void initEvent() {
          btnCari.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  String dataUrl = edInput.getText().toString();
                  dataUrl = dataUrl.isEmpty() ? "google" : dataUrl;
                  loadWebview("https://" + dataUrl + ".com");
                  message("Data link is "+dataUrl);
              }
          });
      }
  
      private void message(String pesan){
          Toast.makeText(MainActivity.this,pesan, LENGTH_SHORT).show();
      }
  
      private boolean checkConnection(){
          ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
          NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();
          return networkInfo != null &amp;&amp; networkInfo.isConnectedOrConnecting();
      }
  
      private void statusConnection(){
          if (checkConnection()){
              message("Device Online");
          }else{
              message("Device Offline");
          }
      }
  
      private void loadWebview(String url){
          webView.getSettings().setJavaScriptEnabled(true);
          webView.setWebViewClient(new WebViewClient());
          webView.loadUrl(url);
          webView.getSettings().setBuiltInZoomControls(true);
          webView.getSettings().setSupportZoom(true);
  
      }
  
      public class asynCaller extends AsyncTask&lt;Void, Void, Void&gt; {
          ProgressDialog progressDialog = new ProgressDialog(MainActivity.this);
  
          @Override
          protected void onPreExecute() {
              super.onPreExecute();
  //            progressDialog.setMessage("Loading...");
  //            progressDialog.show();
              message("persiapan");
          }
  
          @Override
          protected Void doInBackground(Void... params) {
              statusConnection();
              if (checkConnection()) {
                  dataUrl = dataUrl.isEmpty() ? "google" : dataUrl;
                  loadWebview("https://" + dataUrl + ".com");
                  message("Data link is " + dataUrl);
              }
              return null;
          }
  
          @Override
          protected void onPostExecute(Void result) {
              super.onPostExecute(result);
  //            progressDialog.dismiss();
              message("selesai");
          }
      }
  </code></pre>
  
  <p><strong>EDITED</strong>
  thank's for your help 
  i change a method doInBackground to onProgressUpdate for showing Webview and work and i get new problem with progress dialog, the progress dialog can't dismiss()</p>
  
  <pre><code>@Override
          protected String doInBackground(String... params) {
              publishProgress();
              return url;
          }
  
          @Override
          protected void onPreExecute() {
              super.onPreExecute();
              url = edInput.getText().toString();
              progressDialog.show(MainActivity.this,"Pesan","Memuat . . .",true);
          }
  
          @Override
          protected void onPostExecute(String result) {
              if (progressDialog.isShowing()){
                  progressDialog.dismiss();
              }
          }
  
          @Override
          protected void onProgressUpdate(Void... values) {
              super.onProgressUpdate(values);
              loadWeb(url);
          }
      }
  </code></pre>