Implement the locationListner interface and start the wait dialog, override the onlocation change method and just cancel the dialog, the best.
public class MainActivity extends Activity implements LocationListener {
ProgressDialog dialog; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //-------------------- Start your GPS Reading ------------------ // dialog = new ProgressDialog(this); dialog.setMessage("Please wait!"); dialog.show(); } @Override public void onLocationChanged(Location arg0) { dialog.dismiss(); } @Override public void onProviderDisabled(String provider) { // TODO Auto-generated method stub } @Override public void onProviderEnabled(String provider) { // TODO Auto-generated method stub } @Override public void onStatusChanged(String provider, int status, Bundle extras) { // TODO Auto-generated method stub }
source share