Thursday, March 31, 2011

[android-developers] onWindowFocusChanged() happens more than once when resuming the application from the homescreen or app drawer

Scenario 1 - NORMAL
###################### application activity started ###########################
03-31 17:52:18.413: INFO/System.out(589): onCreate()
03-31 17:52:18.974: INFO/System.out(589): onWindowFocusChanged() -> hasFocus:true
03-31 17:52:18.974: INFO/System.out(589): mySoundPlaybackMethods()
########## back button pressed to remove activity from the task ###############
03-31 17:54:54.113: INFO/System.out(589): onWindowFocusChanged() -> hasFocus:false
03-31 17:54:54.514: INFO/System.out(589): onDestroy()
###################### application activity finished ##########################


Scenario 3 - ABNORMAL
######################## application activity started ##########################
03-31 18:16:55.823: INFO/System.out(589): onCreate()
03-31 18:16:56.124: INFO/System.out(589): onWindowFocusChanged() -> hasFocus:true
03-31 18:16:56.139: INFO/System.out(589): mySoundPlaybackMethods()
############################# HOME button pressed ##############################
03-31 18:17:03.244: INFO/System.out(589): onSaveInstanceState() -> state saved
03-31 18:17:03.424: INFO/System.out(589): onWindowFocusChanged() -> hasFocus:false
####################### Landed onto homescreen launcher ##########################
########### Pressed on the application button to go back to the task #############
03-31 18:18:51.544: INFO/System.out(589): onWindowFocusChanged() -> hasFocus:true
03-31 18:18:51.593: INFO/System.out(589): mySoundPlaybackMethods()
---------------------------------------------------------------------------------------------------------------
?????? in the following output, why should the same steps of windowFocusChanged false->true and soundPlayback happen ONCE AGAIN ??????
---------------------------------------------------------------------------------------------------------------
03-31 18:18:52.404: INFO/System.out(589): onWindowFocusChanged() -> hasFocus:false
03-31 18:18:52.424: INFO/System.out(589): onWindowFocusChanged() -> hasFocus:true
03-31 18:18:52.484: INFO/System.out(589): mySoundPlaybackMethods()
############## back button pressed to remove activity from the task ################
03-31 18:20:00.204: INFO/System.out(589): onWindowFocusChanged() -> hasFocus:false
03-31 18:20:00.344: INFO/System.out(589): onDestroy()
######################### application activity finished ############################

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment