Try adding loging to the activity's onDestroy.

Methinks you might be seeing the activity get created, destroyed, and
created again due to some combination of launch flags or requested screen
orientation.

-- K

2012/7/18 Mind <[email protected]>

> Debugged some more.  This is not a race condition.  Here is what I am
> seeing:
>
>         Log.i("WH", "TitleScreen: Starting new game");
>         finish();
>         Intent i = new Intent();
>         i.setClassName("com.blah",
> "com.rhs.wordhero.game.Activity_GameScreen");
>         startActivity(i);
>         Log.i("WH", "TitleScreen: Starting new game: Done");
>
> And in Activity_GameScreen:
>
>     public Activity_GameScreen()
>     {
>         Log.i("WH", "GameScreen Constructor");
>
> And my logs look like this:
>
> 07-18 09:26:33.762: I/WH(4338): TitleScreen: Starting new game
> 07-18 09:26:33.782: I/WH(4338): TitleScreen: Starting new game: Done
> 07-18 09:26:33.892: I/WH(4338): GameScreen Constructor
> 07-18 09:26:33.892: I/WH(4338): GameScreen onCreate
> 07-18 09:26:34.372: I/WH(4338): GameScreen Constructor
> 07-18 09:26:34.372: I/WH(4338): GameScreen onCreate
>
> So, it seems that the code is starting TWO copies of the new
> Activity.....  Any ideas ?
>
>
>
>
> On Wednesday, July 18, 2012 2:50:57 AM UTC-4, Dianne Hackborn wrote:
>>
>> The log line you posted just means that for some reason your UI thread
>> has been busy so missed frames.
>>
>> If the code you printed is executing that log line more than once, then
>> you either have a race condition (because this is being executed from
>> multiple threads), or something is clearing that flag.  Either way, at this
>> point it looks like an issue in the app.
>>
>> On Tue, Jul 17, 2012 at 9:08 PM, Mind <[email protected]> wrote:
>>
>>> 1st:  This does NOT occur on ICS.
>>>
>>> I have two Activities that I cycle between.  Game screen and Results
>>> screen (don't complain about not using Activity Fragments).
>>>
>>> I end one with finish() and then call the next.  If I exit out using the
>>> back button, some time later one of the Activies pops up.  Presumably
>>> because the timed game round ends and the next activity is auto-started or
>>> something.
>>>
>>> Additionally, I have a timer loop using Runnable.  Inside the loop I do
>>> things like this:
>>>
>>> if (game_time > 0 && game_time < 5 && flag)
>>> {
>>>   flag = false;    /// class variable
>>>   Log.i("WTF", "Why do I see this message more than once?");
>>> ... }
>>>
>>> Well, this code gets run MULTIPLE times.... I can see the log messages.
>>>
>>> If I upload the EXACT same APK to an ICS device, these behaviors do not
>>> happen.
>>>
>>> I also see this message in the log:
>>> 07-18 00:05:51.187: I/Choreographer(20425): Skipped 42 frames!  The
>>> application may be doing too much work on its main thread.
>>>
>>> Is anyone seeing anything similar or can explain this ?
>>>
>>>
>>>  --
>>> 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 <[email protected]>
>>> To unsubscribe from this group, send email to
>>> android-developers+**[email protected]<android-developers%[email protected]>
>>> For more options, visit this group at
>>> http://groups.google.com/**group/android-developers?hl=en<http://groups.google.com/group/android-developers?hl=en>
>>
>>
>>
>>
>> --
>> Dianne Hackborn
>> Android framework engineer
>> [email protected]
>>
>> Note: please don't send private questions to me, as I don't have time to
>> provide private support, and so won't reply to such e-mails.  All such
>> questions should be posted on public forums, where I and others can see and
>> answer them.
>>
>>   --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

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

Reply via email to