Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Handle back button in Android — Gideros Forum

Handle back button in Android

hgvyas123hgvyas123 Guru
edited December 2013 in General questions
ok i know it is a stupid question but i cant find solution for this plz help

this is the what i am doing currently
self:addEventListener(Event.KEY_DOWN, function(event) 
 
		if (event.keyCode == Keycode.BACK) then
			local exitbuttonBoard = Bitmap.new(Texture.new("gfx/exitbutton bord.png"))
			exitbuttonBoard:setAnchorPoint(0.5,0.5)
			exitbuttonBoard:setPosition(480,320)
			self:addChild(exitbuttonBoard)
 
			local playOnBtn = myGButton.new("gfx/Play on.png","gfx/Play on hover.png")
			playOnBtn:setPosition(-142,-120)
			exitbuttonBoard:addChild(playOnBtn)
 
			local endGame = myGButton.new("gfx/end game.png","gfx/end gamehover.png")
			endGame:setPosition(-142,0)
			exitbuttonBoard:addChild(endGame)
 
			endGame:addEventListener("click",function()
				application:exit() --- quit the game
			end)
 
			playOnBtn:addEventListener("click",function()
				exitbuttonBoard:removeFromParent()---so user can continue to play where he had left
			end)
		end
	end)
:)

Comments

Sign In or Register to comment.