Log in or register to post comments

ImageTarget Lifecycle

April 28, 2013 - 7:56am #1

Hi, 

Firstly, I'm not sure  how to call this problem in my subject.
I'm modifying Imagetarget and updating the virtual object during runtime. However, after I quit  the ImageTarget, and load into it again, my virtual object remain at the last state I quit the apps instead of the initial state as I expected. 

can anyone explain why it was that and how to make the virtual object return to it's initial state whenever I load the ImageTarget?

Thanks

ImageTarget Lifecycle

April 29, 2013 - 12:26am #4

Hi, you can keep it in global scope (so that you can access it easily); what I would recommend however is to add a "void reset()" member function to your class X, and then call the  reset() function on your object in the initApplicationNative() function. The reset() function should set the internal parameters of class X object to zero.

 

 

ImageTarget Lifecycle

April 28, 2013 - 11:34pm #3

Hi,
I put a constructor  of class "x", to reset my virtual object to it's initial state into global scope in ImageTarget.cpp, and whenever I quit my app (I saw onDestroy get called), I noticed that my constructor did not get called whenever I load my app again (I saw onCreate get called). 

I can place the constructor to the InitApplicationNative(), but sometimes I need to get the variable of class x from other functions, since I did not declare it in global scope, it will not allow me to get access  the variable of class x. Do you have any clue to solve this?

Thanks

ImageTarget Lifecycle

April 28, 2013 - 1:19pm #2

Hi, probably you are not quitting the App, but just pausing it.

You could reset your object position when you pause the app (i.e. from the onPause() method of your activity)

 

Log in or register to post comments