Handler inside a Thread run
<p>I'm new to android, bear it with me.</p>

<p>I've a TimerTask for which I define run() inside the Service. Inside run(), I'm calling </p>

<pre><code>locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,
    LOCATION_UPDATES_MIN_TIME_MS, LOCATION_UPDATES_MIN_DISTANCE_M, gpsListener);
</code></pre>

<p>and it complains that can't create Handler, since I believe its a background thread. How do I solve it?</p>

<p>Edit: Code snippet</p>

<pre><code>locationTask = new TimerTask() {

        @Override
        public void run() {
            Log.d(Commands.TAG, "Running location Task");
            myLocationProvider = new MyLocationProvider(locationManager, handler, MyService.this);
            myLocationProvider.start();
            myLocationProvider.stop();
        }
    };
</code></pre>

<p>and later its Scheduled as below:</p>

<pre><code>locationTimer = new Timer();
  locationTimer.schedule(locationTask, 10000, cmds.getAlertInterval()*60);
</code></pre>

<hr>

<p>and when .start is called, requestLocationUpdates() fails</p>
