Hi Friends,

This is kiran new to android. I am trying to find latitude and
longitude through NetworkProvider.

I got values for lat and langs when i am executing the applicarion
first time and the values are not changing even i am moving  200
meters far from current location.(I am executing newly in the new
location ie after 200 mt  ) .

My code is as fallowing

public class WhereAmI extends Activity {
    /** Called when the activity is first created. */
        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.main);
                LocationManager locationManager;
                String context = Context.LOCATION_SERVICE;
                locationManager = (LocationManager)getSystemService(context);
                String provider = LocationManager.NETWORK_PROVIDER;
                Location location =
                locationManager.getLastKnownLocation(provider);

                updateWithNewLocation(location);
                }
                private void updateWithNewLocation(Location location) {



                        String latLongString;
                        TextView myLocationText;

                        myLocationText = 
(TextView)findViewById(R.id.myLocationTxt);
                        if (location != null) {


                        double lat = location.getLatitude();
                        double lng = location.getLongitude();
                        double alt=location.getAltitude();
                        latLongString = "Lat:" + lat + "\nLong:" + 
lng+"\naltitude"+alt;
                        } else {
                        latLongString = "No location found";
                        }
                myLocationText.setText("Your Current Position is:\n"
+latLongString);


        }

}

what can i do for getting updated lat ,longs for new locations?

Can any one help me?

Thanks and Regards,

Kiran.

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

Reply via email to