Move the declaration of done_once into the anonynous inner class itself, so it's the same variable between first and subsequent calls to this function.

The way you had it, as a method-local, meant it was getting created and initialized to "false" every time through. In other words, doing nothing.

-- Kostya

26.09.2010 20:44, Lucas Boucher ?????:
"Check GPS Status Again.", new DialogInterface.OnClickListener() {
_* *__*

boolean done_once = false;

*_
@Override

public void onClick(DialogInterface dialog, int id) {
((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
*
**

if

*(!done_once)

{
if (latitude == 0 || longitude == 0)
{
gps_initialized=
false
;
dialog.dismiss();
main();
}
else
{
gps_initialized=
true;
dialog.dismiss();
main();
}
}

}
});



--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to