title: Can't create handler inside thread which has not called Looper.prepare()
body: <p>I have an Activity, and in that I have a class.</p>
  
  <pre><code>text=new Dynamictext(...);
  text.setText("txt");
  </code></pre>
  
  <p>in my DynamicText java I have this code:</p>
  
  <pre><code>public void setText(String text) {
      this.text=text;
      new asyncCreateText().execute();
      //this.createText(text);
  }
  
  //private Handler handler = new Handler();
  
  private class asyncCreateText extends AsyncTask&lt;Void, Void, Void&gt; 
  {
      @Override
      protected Void doInBackground(Void... unused) {
          return null;
      }
  
      @Override
      protected void onPostExecute(Void unused) {
  
      }
  }
  </code></pre>
  
  <p>I get: </p>
  
  <blockquote>
    <p>ERROR/AndroidRuntime(5176): Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()</p>
  </blockquote>
  
  <p>How can I handle this error?</p>
  
  <pre class="lang-none prettyprint-override"><code>ERROR/AndroidRuntime(5370): java.lang.ExceptionInInitializerError
  ERROR/AndroidRuntime(5370):     at com.l.start.DynamicText.setText(DynamicText.java:125)
  ERROR/AndroidRuntime(5370):     at com.l.start.OpenGLRenderer.initfonts(OpenGLRenderer.java:168)
  ERROR/AndroidRuntime(5370):     at com.l.start.OpenGLRenderer.init(OpenGLRenderer.java:119)
  ERROR/AndroidRuntime(5370):     at com.l.start.OpenGLRenderer.onSurfaceChanged(OpenGLRenderer.java:90)
  ERROR/AndroidRuntime(5370):     at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1120)
  ERROR/AndroidRuntime(5370):     at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:975)
  
  ERROR/AndroidRuntime(5370): Caused by: java.lang.RuntimeException: 
      Can't create handler inside thread that has not called Looper.prepare()
  ERROR/AndroidRuntime(5370):     at android.os.Handler.&lt;init&gt;(Handler.java:121)
  ERROR/AndroidRuntime(5370):     at android.os.AsyncTask$InternalHandler.&lt;init&gt;(AsyncTask.java:421)
  ERROR/AndroidRuntime(5370):     at android.os.AsyncTask$InternalHandler.&lt;init&gt;(AsyncTask.java:421)
  ERROR/AndroidRuntime(5370):     at android.os.AsyncTask.&lt;clinit&gt;(AsyncTask.java:152)
  ERROR/AndroidRuntime(5370):     ... 6 more
  </code></pre>