Progress Dialog location listener

hejoidgetroge

New Member
Within my programme i have a location listner used with the GPS to gain the user current lat/long points.I want to implement a progress Dialog whilst the GPS gains the co-ordinates.Currently I call the progressDialog within the onCreate() method then when my location object is nolonger null, then i dismess the progressdialog.Sadly at the moment the dialog does not show at all.Here is my code:\[code\]protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); locationListener = new GPSLocationListener(); locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener); ***** Call a new progress dialog object when the locationManager is gaining lat/long***** d = ProgressDialog.show(this, "GPS Posistion", "Gaining GPS posistion...", false, true);} private class GPSLocationListener implements LocationListener { @Override public void onLocationChanged(Location location) { if (location != null) { ***** Once lat/long is found, dismiss the progress dialog***** d.dismiss(); Double latToPass = location.getLatitude(); Double longToPass = location.getLongitude(); locationManager.removeUpdates(locationListener); locationManager = null; Intent changesStart = new Intent("com.example.flybaseapp.PassLatLong"); changesStart.putExtra("passedLat", latToPass); changesStart.putExtra("passedLong", longToPass); startActivity(changesStart); } }\[/code\]
 
Back
Top