+1  A: 

Are you having this problem in the emulator or on a device? If on the emulator, make sure you use DDMS to set a GPS location. But the easiest thing to do might be to run your code on a device to see if you get GPS updates that way.

Mike
Hi Mike, I tested in my HTC Hero. But no luck. Is there any wrong with my code? or can you suggest me any other way to get gps location in Widget?Thanks for your quick respnose...
Raghavendra
I'd love to help but I'm not very familiar with widgets. One thing I forgot to mention is to make sure you walk around outside with your device -- I've struggled with code in the past, only to realize that the device couldn't get a GPS fix indoors and thus wasn't sending me GPS updates at all.
Mike
+4  A: 

The problem I see is that you are trying to check curLocation in onStart() right after calling requestLocationUpdates(). LocationManager.requestLocationUpdates() is asynchronous, meaning your LocationListener will not get called back until after onStart() has returned. Have your LocationListener update the UI after it receives the location, don't try and do it in onStart.

Bryan Bedard
Hi Bryan, You are right. I faced the problem with the Time Intervals which I have given to the AppWidget(20 sec) and the Location Listener(2 sec). Then both are not synchronized with each other. I set the Time Interval for AppWidget to 1 minute and for Location Listener to 20 seconds. Now it is working fine... Thank you very much for your guidance...
Raghavendra
Happy to help. If you have a minute, perhaps mark this answer as the correct one.
Bryan Bedard