سؤال

I have to call a Async Task with listener from the TimerTask eack 1.5 seconds.When I tried to do that I'm getting an exception "java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare().". Please help us to solve this issue.

Following is the piece of code I use..

     Timer t = new Timer();     
 TimerTask scanTask = new TimerTask()
 {
    @Override
    public void run()
        {
        new BgTask((BgTaskListener)this).execute("","currentState");
    }

};

t.schedule(scanTask, 1500, 1500);

Here BgTask id the AsyncTask class.

لا يوجد حل صحيح

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top