Hi,

I write a class which implements LocationListener. Its just listeneing
to the location. I tried the code in Tatoo, but its not working. The
code is..

public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                lm = (LocationManager) 
getSystemService(Context.LOCATION_SERVICE);
                lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, 
this);
                tv = new TextView(this);
                latLongString = "Lat: " + currLat + "\nLong: " + currLong;
                tv.setText(latLongString);
                setContentView(tv, new LayoutParams(LayoutParams.WRAP_CONTENT,
                                LayoutParams.WRAP_CONTENT));
}

        public void onLocationChanged(Location location) {
                // TODO Auto-generated method stub
                System.out.println(" onLocationChanged :: ");
                if (location != null) {
                        latLongString = "Lat : " + location.getLatitude() + " 
Long : "
                                        + location.getLongitude();
                        Log.i("onLocationChanged(): ", latLongString);
                        Toast.makeText(this, latLongString, 
Toast.LENGTH_SHORT).show();
                        tv.setText(latLongString);
                } else {
                        latLongString = " Location not found";
                        tv.setText(latLongString);
                }
//              tv.invalidate();
}

onLocationChanged is not calling at all. GPS is enabled in the device
and I put all permissions in manifest also.

<uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION" />

Nithin


-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to