I am having a problem with Android looper. I have a class that has extended AsynTask. Inside doInBackground() method i have Looper.prepare() and some code below.
It runs well and good for the first time but after that it gives an exception " Only one Looper may be created per thread" .
There seems some solution to use Looper.quit() but i am unable to implement it.
Any help will be appreciated.
class LooperThread extends Thread {
      public Handler mHandler;
      public void run() {
          Looper.prepare();
          mHandler = new Handler() {
              public void handleMessage(Message msg) {
                  // process incoming messages here
              }
          };
          Looper.loop();
      }
  }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With