Conditions for if sticker not moving go back to 2nd page

I doing a project on shoe sticker. My project is similar to this https://www.youtube.com/watch?v=3e7FtmpoGO8&feature=youtu.be. How to have conditions for when customer put the shoe down it will go back to 2nd page, else do nothing. I’m using code at https://github.com/Estimote/Android-SDK/tree/master/Demos/src/main/java/com/estimote/examples/demos/activities

I thinking of something like this

//Where can I put this block of codes to?
if ( shoe is not picked)
{
//Go back to 2nd page
//What codes should I put here
}
else
{
//do nothing
}