Hello guys,
I am new to android n i hv got problem with gps application.i will post the code ....there are no errors....bt nothing is being displayed...
i'am just trying to print the coordinates of my current location...a basic gps application in one of the books on android.
package com.gps;
import android.view.View;
import android.content.Context;
import android.location.Location;
import android.location.LocationManager;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
public class gps extends Activity {
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
LocationManager locationManager;
String context = Context.LOCATION_SERVICE;
locationManager = (LocationManager)getSystemService(context);
String provider = LocationManager.GPS_PROVIDER;
Location location = locationManager.getLastKnownLocation(provider);
updateWithNewLocation(location);
}
private void updateWithNewLocation(Location location) {
String latLongString;
TextView myLocationText;
myLocationText = (TextView)findViewById(R.id.TextView01);
if (location != null) {
double lat = location.getLatitude();
double lng = location.getLongitude();
latLongString = "Lat:" + lat + "\nLong:" + lng;
} else {
latLongString = "No location found";
}
myLocationText.setText("Your Current Position is:\n" +
latLongString);
}
}
wat am i missing..... please help me out....thanks in advance...



