title: Android: AsyncTask: Long execution time after calling onPostExecute
body: <p>I have a simple Android AsyncTask with a long background action:</p>
  
  <pre><code>HANDLER.post(new Runnable() {
              @Override
              public void run() {
                  new AsyncTask&lt;Context, Integer, GameTypeAdapter&gt;() {
                      @Override
                      protected GameTypeAdapter doInBackground(Context... contexts) {
                          return new GameTypeAdapter(contexts[0]);//Long database action
                      }
  
                      @Override
                      protected void onPreExecute() {
                          pbWaiter.setVisible(View.VISIBLE);
                      }
  
                      @Override
                      protected void onPostExecute(GameTypeAdapter gameTypeAdapter) {
                          txtGameName.setText(settings.getGameName());
  
                          cmbType.setAdapter(gameTypeAdapter);
                          if (settings.getGamePlugin() != null) {
                              cmbType.setSelection(((GameTypeAdapter) cmbType.getAdapter()).getItemPosition(settings.getGamePlugin()));
                          }
  
                          sldJoker.setProgress(settings.getJoker());
  
                          pbWaiter.setVisible(View.INVISIBLE);
                      }
                  }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, getActivity());
              }
          });
  </code></pre>
  
  <p>If the method onPostExecute is called by thread and the last line (hideWaiter) was called the execution of the UI calls are visible after 1/10 seconds (a half second in debug mode). In this time the UI hangs and the waiter animation stops.</p>
  
  <p>Why the UI thread stops?</p>
  
  <p>Thanks.</p>