Understood and fixed, now onStart is called nowhere in my app.

Here is where my code currently stands, and i can still button mash it.
I am starting to wonder if this will happen on the actual hardware.


gps_init_alt_bld =
new AlertDialog.Builder(this);
gps_init_alt_bld.setMessage(
"GPS Not Initialized Yet.")
.setCancelable(
false)
.setPositiveButton(
"Check GPS Status Again.", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
((AlertDialog)
dialog).getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
*

boolean* done_once = *false*;
*

if*(!done_once)

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

}
});

On Sun, Sep 26, 2010 at 12:19 PM, Mark Murphy <mmur...@commonsware.com>wrote:

> On Sun, Sep 26, 2010 at 12:06 PM, Lucas Boucher <lbouche...@gmail.com>
> wrote:
> > I don't see how my calls to onStart()
> > would cause this specific issue and don't want to fix something that
> isn't
> > broke just to make code look better.
>
> Except it is broke. Do not call onStart() of an activity yourself, please.
>
> > All my app needs to do is go thru a sequence of checks, gps, gps init,
> > internet availability, is my location in some list, then display a pic.
> > If it fails anywhere along the line I wanted to throw a dialog box.
> > The user can check whatever errored.
> > Then i just want to run thru the whole sequence again.
>
> Then move "the whole sequence" into another method, that you call from
> onStart() and your dialog button.
>
> > Thus I called onStart().
>
> This does not "start the whole program again". What it will do is
> confuse the heck out of the Activity base class. Do not do this.
>
> While restarting your activity seems like a wasteful solution, to do
> this, call startActivity(getIntent()), followed by finish(). The first
> statement should run another copy of your Activity; the second
> statement will get rid of your existing copy.
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> Android Training...At Your Office: http://commonsware.com/training
>
> --
>  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<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Lucas Boucher
www.pachristmas.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