Android Can't create handler inside thread that has not called Looper.prepare()
<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 : 
02-15 22:32:37.328: ERROR/AndroidRuntime(5176): Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()</p>

<p>How can i handle this error?</p>

<p>edited:</p>

<p>error:</p>

<pre><code>02-15 22:52:43.483: ERROR/AndroidRuntime(5370): java.lang.ExceptionInInitializerError
02-15 22:52:43.483: ERROR/AndroidRuntime(5370):     at com.l.start.DynamicText.setText(DynamicText.java:125)
02-15 22:52:43.483: ERROR/AndroidRuntime(5370):     at com.l.start.OpenGLRenderer.initfonts(OpenGLRenderer.java:168)
02-15 22:52:43.483: ERROR/AndroidRuntime(5370):     at com.l.start.OpenGLRenderer.init(OpenGLRenderer.java:119)
02-15 22:52:43.483: ERROR/AndroidRuntime(5370):     at com.l.start.OpenGLRenderer.onSurfaceChanged(OpenGLRenderer.java:90)
02-15 22:52:43.483: ERROR/AndroidRuntime(5370):     at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1120)
02-15 22:52:43.483: ERROR/AndroidRuntime(5370):     at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:975)

02-15 22:52:43.483: ERROR/AndroidRuntime(5370): Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
02-15 22:52:43.483: ERROR/AndroidRuntime(5370):     at android.os.Handler.&lt;init&gt;(Handler.java:121)
02-15 22:52:43.483: ERROR/AndroidRuntime(5370):     at android.os.AsyncTask$InternalHandler.&lt;init&gt;(AsyncTask.java:421)
02-15 22:52:43.483: ERROR/AndroidRuntime(5370):     at android.os.AsyncTask$InternalHandler.&lt;init&gt;(AsyncTask.java:421)
02-15 22:52:43.483: ERROR/AndroidRuntime(5370):     at android.os.AsyncTask.&lt;clinit&gt;(AsyncTask.java:152)
02-15 22:52:43.483: ERROR/AndroidRuntime(5370):     ... 6 more
</code></pre>
