I want look for my GPS signal, while it’s looking for it I have a ProgressDialog, but, it showed when the task is finished:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
DialogInterface.OnCancelListener dialogCancel = new DialogInterface.OnCancelListener() {
public void onCancel(DialogInterface dialog) {
Toast.makeText(getBaseContext(),
"no encotnrada",
Toast.LENGTH_LONG).show();
// handler.sendEmptyMessage(0);
}
};
pd = ProgressDialog.show(this, "buscando", "gps", true, true, dialogCancel);
while(currentLocation == null){
}
Thread thread = new Thread(this);
thread.start();
}
in run() I look for my currentLocation value.
How can I wait for this signal in order to show the dialog?
Thank you in advance
I’ve used GPS, and the GPS process is not running on the same process that running your app.
so there must be something wrong with your code, the
GPS listenerfires alocationobject if signal is found, so you candismissyourProgressDialog.