Press back button return to app

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
yeop
Posts: 4
Joined: Thu Nov 17, 2016 6:55 am

Press back button return to app

Post by yeop » Thu Nov 17, 2016 7:02 am

Hi all,
i need help for the coding
i want to create simple video application,

1. user touch the button, and the video will be played
2. user can touch black bar of the video to return to the app
3. user can touch back button to return to the app <--- im stuck at here

while i playing the video, and when i tried to touch back button, it will quit and go the android screen,
what code should i use to return to the app when i touch the android back button?

here is my code

Code: Select all

on mouseUp
   set the showController of the templatePlayer to true
   put specialFolderPath("engine") & "/wifi.mp4" into tVideoFile
   play video tVideoFile
end mouseUp

on movieTouched
   play stop
end movieTouched

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7230
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Press back button return to app

Post by jacque » Thu Nov 17, 2016 6:24 pm

Put a backKey handler in the card script. (See "backKey" in the dictionary.)
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

yeop
Posts: 4
Joined: Thu Nov 17, 2016 6:55 am

Re: Press back button return to app

Post by yeop » Sat Nov 19, 2016 6:46 am

jacque wrote:Put a backKey handler in the card script. (See "backKey" in the dictionary.)
im sorry, i not quite understand how to use the backkey,
where or what should i put?

Code: Select all

on mouseUp
   set the showController of the templatePlayer to true
   put specialFolderPath("engine") & "/wifi.mp4" into tVideoFile
   play video tVideoFile
end mouseUp

on backKey

end backKey

on movieTouched
   play stop
end movieTouched


shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: Press back button return to app

Post by shaosean » Sat Nov 19, 2016 7:59 am

Exactly like you have it.. In the card script..

Code: Select all

on backKey
  go to card 1  //-- you would put whatever you want to happen right here..
end backKey

yeop
Posts: 4
Joined: Thu Nov 17, 2016 6:55 am

Re: Press back button return to app

Post by yeop » Sat Nov 19, 2016 8:52 am

shaosean wrote:Exactly like you have it.. In the card script..

Code: Select all

on backKey
  go to card 1  //-- you would put whatever you want to happen right here..
end backKey
i did try go to card 1 , still when press back key it will go to android screen, not the app
i also tried card id "1002" still same...
cardid.png

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: Press back button return to app

Post by shaosean » Sat Nov 19, 2016 9:41 am

You have it in the button script.. You need to put it in your card script..

yeop
Posts: 4
Joined: Thu Nov 17, 2016 6:55 am

Re: Press back button return to app

Post by yeop » Sat Nov 19, 2016 10:32 am

shaosean wrote:You have it in the button script.. You need to put it in your card script..
thank you soo muchh :D
its working but not what i wanted :(

now, while the video is playing i cant quit XD
and the app also, unless i touch home button.
any workaround to go back to the app while the video playing when touch back button?

sendvid.c_om/h997sce5 <= video , remove _

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: Press back button return to app

Post by shaosean » Sat Nov 19, 2016 10:37 am

No idea.. Could be a bug, could be something in the code..

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: Press back button return to app

Post by shaosean » Sat Nov 19, 2016 11:18 am

Well, that is the simplest code in the world, so no idea what the issue could be..

Post Reply

Return to “Android Deployment”