title: android - doInBackground return always false
body: <p>I'm trying to shows a ProgressDialog while a list is loading data in an AsyncTask, but 'exito' in onPostExecute is never true, and the dialog never dismiss.
  I tried to delete the <code>if (exito)</code> but the progressDialog dismiss and the list is charged a few seconds later, and it isn't I want. 
  I want that progressDialog shows while is loading, and when is loaded, dismiss the progressDialog and change fragment.</p>
  
  <p>Where is my mistake? Thanks</p>
  
  <pre><code>private class ATCargarProductos extends  AsyncTask&lt;Void, Integer, Boolean&gt;{
  
          boolean terminado = false;
          Bundle bdl;
          FragmentTransaction transaction;
          ProgressDialog progressDialog;
          ArrayList&lt;ItemDetails&gt; results = new ArrayList&lt;ItemDetails&gt;();
  
          public ATCargarProductos(FragmentTransaction transaction){
              this.transaction = transaction;
          }
  
          @Override
          protected Boolean doInBackground(Void... params) {
              if (compruebaConexion()) {
  
                  rellenaLista(new CallBack() {
                      @Override
                      public void onSuccess(final ArrayList&lt;Comida&gt; listaComidas) {
                          for (int i = 0; i &lt; listaComidas.size(); i++) {
                              ItemDetails item_details = new ItemDetails(listaComidas.get(i));
                              if (item_details.getTipo().equals("B")) {
  
                                  results.add(item_details);
                              }
                          }
  
                          Fragment fragmentProductos = new FragmentProductos();
                          bdl = new Bundle(2);
                          bdl.putInt("tipoProducto", 1);
                          bdl.putParcelableArrayList("resultados", results);
                          fragmentProductos.setArguments(bdl);
  
                          completado = true;
  
                      }
  
                      @Override
                      public void onFail(String msg) {
  
                      }
                  });
  
                  return completado;
  
              } else {
                  return false;
              }
          }
  
          @Override
          protected void onPreExecute() {
              super.onPreExecute();
              progressDialog = new ProgressDialog(getActivity(), R.style.AppTheme_Dark_Dialog);
              progressDialog.setIndeterminate(true);
              progressDialog.setMessage("Cargando lista...");
              progressDialog.show();
          }
  
          @Override
          protected void onPostExecute(Boolean exito) {
              super.onPostExecute(exito);
              if (exito) {
                  progressDialog.dismiss();
                  transaction.commit();
              }
          }
      }
  </code></pre>