title: How to do GUI stuff in background? (Android)
body: <p>I tried to do gui stuff with <code>asynctask</code>, but it not works on every device. Why?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>public class DownloadWebPageTask extends AsyncTask&lt;ReadEvent, Void, String&gt; {
  
      long difference;
      ReadEvent readevent;
  
      @Override
      protected String doInBackground(ReadEvent... readevents) {
          this.difference = (readevents[0].getDtstart() - calendar_millis) / 1000 / 24 / 60 / 60;
          this.readevent = readevents[0];
  
          return "";
      }
  
      @Override
      protected void onPostExecute(String result) {
          super.onPostExecute(result);
          MonthFragment.this.addDate((int) difference + MonthFragment.this.start - 1, readevent.getEventname(), readevent.getCalendarid(), readevent.getEventcolor());
      }
  }
  </code></pre>
  
  <p>This is within a <code>fragment</code>. The method addDate adds the <code>TextView</code> to GUI. It works great on Honor Huawei 6X Honor (Android 7.0) it works great. On BQ Aquaris X5 (Android 7.1.1) it doesn't.</p>
  
  <p>What is the best way, to do GUI stuff in background?</p>