package android_programmers_guide.AndroidLBS;

import android.app.Activity;
import android.os.Bundle;
import android.location.LocationManager;
import android.view.View;
import android.widget.TextView;
import android.content.Context;
import android.widget.Button;
public class androidlbs extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
final Button gpsButton = (Button) findViewById(R.id.gpsButton);
gpsButton.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v){
LoadCoords();
}});
}
public void LoadCoords(){
TextView latText = (TextView) findViewById(R.id.latText);
TextView lngText = (TextView) findViewById(R.id.lngText);
LocationManager myManager = (LocationManager)
getSystemService(Context.LOCATION_SERVICE);
Location latt = myManager.getCurrentLocation("gps"); //error is here
Double latPoint = latt.getLatitude();
Double lngPoint = latt.getLongitude();
latText.setText(latPoint.toString());
lngText.setText(lngPoint.toString());
}
}

I using the above code to find my location on mobile. But the  lines

 Location latt = myManager.getCurrentLocation("gps");

throwing error in eclipse saying getCurrentLocation is not associated
with locationmanager. Can anyone help me in this regard.

Thanks
Pavan

--~--~---------~--~----~------------~-------~--~----~
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