java - Android App strange behaviour when comeing back from sleep -


since stuck on problem , don't know mistake need ask guys. when first launch app works fine, when press "back" button on phone main screen , start app again (which not real new startup because app goes sleep) has strange behaviour.

i using opengles draw texture onto screen , when make touch texture changes. touch sets boolean true indicates draw other texture. somehow false when test value when got written true touch event. wondering because happens when pressed "back" button on phone. when returning main screen home button , moving app thing doesnt occur , works.

first thought threads 2 different threads(activity rendering thread , surfaceview thread touch events) when synchronizing get/set methods still doesnt work. starting think touch thread thing still operating on old objects , changes values there while references in rendering thread newly instanciated boolean set touch rendering thread takes default value because got different objects somehow not possible.

well @ end of knowledge please enlighten me

edit: found mistake... when device came sleep created object(the textured square) , touch event occured on old 1 not delted , new 1 got drawn.

also nice if tell me exact methods called when comes sleep? onresume or there more? , references, deleted because there shouldnt created object, test == null , create new 1 somehow seems true when comes

as answer second question, can learn more on activity life cycle here: http://developer.android.com/reference/android/app/activity.html#activitylifecycle

what have resource manager knows has been loaded , handles life cycle of textures, models, etc. when app goes stopped or paused, resource manager unloads resources (you may don't when paused, on stopped) , when app resumed, reload resources , regenerate opengl context (remember unless something, ie state @ manifest, system destroy opengl context). need setup textures, buffer objects , on. can extend idea handle needs persisted during application life cycle.

happy coding!


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -