title: How update Progress Bar of dialog element in asyncTask?
body: <p>I'm currently searching how to update my progress bar which is located in my dialog window.
  I have already multiple post on this but I can't understand why my progress bar won't update.</p>
  <p>Here is my code :</p>
  <pre><code>public class Dataset1Fragment extends Fragment {
  private static final int APP_SMS_DEFAULT = 5;
  DatabaseHelper myDb;
  ProgressBar progressBar;
  Dialog dialog;
  
  private Button btnInsert;
  private Button btnDelete;
  String[] pictures = null;
  private RelativeLayout lay_dataset1;
  
  @SuppressLint(&quot;InflateParams&quot;)
  @Nullable
  @Override
  public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
  
      View view = inflater.inflate(R.layout.progress, null);
      progressBar = view.findViewById(R.id.loader);
      return inflater.inflate(R.layout.fragment_dataset1, null);
    }
  }
  </code></pre>
  <p>This is the part of fragment where I just called the progressBar</p>
  <p>And this part is my AsyncTask :</p>
  <pre><code> // ASYNC TASK POUR DELETE
  private class ExampleAsyncTaskDelete extends AsyncTask&lt;Integer, Integer, String&gt; {
  
      @Override
      protected void onPreExecute() {
          super.onPreExecute();
          setDialog(true);
          progressBar.setMax(100);
          Log.d(&quot;DELETE THREAD&quot;, &quot;PreExecute&quot;);
      }
  
      @Override
      protected String doInBackground(Integer... integers) {
  
          for (int i=0; i&lt;100;i++){
              publishProgress(i);
              try {
                  Thread.sleep(100);
              }catch (InterruptedException ie){
                  ie.printStackTrace();
              }
          }
          return &quot;Finished!&quot;;
      }
  
      @Override
      protected void onProgressUpdate(Integer... values) {
          super.onProgressUpdate(values);
          progressBar.setProgress(values[0]);
      }
  
      @Override
      protected void onPostExecute(String s) {
          super.onPostExecute(s);
          Toast.makeText(requireContext(), &quot;Delete ok&quot;, Toast.LENGTH_SHORT).show();
          setDialog(false);
          requireActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
      }
  }
  
  public void setDialog(boolean show) {
      if (show) dialog.show();
      else dialog.dismiss();
  }
  </code></pre>
  <p>The those part are in the same file.
  It is not impossible to have a progress bar in a &quot;dialog&quot; right ?
  I missed sth for sure but what?</p>