-1

I am trying to get the GPS location for every Half hour using BroadCastReceiver. But I got following error.

Error message

01-09 17:24:44.340: ERROR/AndroidRuntime(2324): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare().

my code

    mTimer = new Timer();
    mTimerTask = new TimerTask() {
    @Override
     public void run() {
      result();//here i cal the Gps function
        }
     };
     mTimer.scheduleAtFixedRate(mTimerTask,1000,50000);

My Method result() is not getting called.

BenMorel
  • 34,448
  • 50
  • 182
  • 322
user1138509
  • 85
  • 1
  • 8

1 Answers1

0

use Handler in run() method.in Handler handle result(); method.

SBK
  • 1,585
  • 2
  • 16
  • 19