Need a tutorial for Building a simple web browser for Androi
Posted: Sun Jun 14, 2015 5:53 pm
Where can I find a tutorial for “Building a simple web browser for an Android platform”?
I was given a great start with the code below, but on android phones, when I play a mp3 file the screen goes black:
--------------------------------
local sBrowserId,sPlayerId
on preOpenCard
//check to make sure you're in the mobile environment
if the environment is "mobile" then
//set up native player named "SermonPlayer" and use mobilecontrolset to set it's visiblity,rect. etc
mobileControlCreate "player", "SermonPlayer"
put the result into sPlayerId
mobileControlSet sPlayerId, "visible","true"
//I used a grouped rectangle named "PlayerArea" to define the rect of my player
mobileControlSet sPlayerId, "rect", (the rect of grc "PlayerArea")
mobilecontrolset sPlayerId,"Showcontroller","true"
--mobileControlSet sPlayerId, "filename", "http://spokenwordchurch.com/mp3sermons/ ... School.mp3"
//Use the Mobilecontroldo command to play,stop, or pause the player
--mobileControlDo sPlayerId, "play"
//set up native browser set it's rect visibility and URL with mobilecontrolset
mobileControlCreate "browser"
put the result into sBrowserId
mobileControlSet sBrowserId, "rect", the rect of group "Browser"
mobileControlSet sBrowserId, "visible", "true"
mobileControlSet sBrowserId, "url", " http://covingtongoodnews.com/audio-downloads/"
//if the environment is not mobile then exit the handler
else
exit preopencard
end if
end preOpenCard
on browserStartedLoading pUrl
//when the browser tries to load a URL, if it is an MP3, then use the mobilecontrolset command to laod it into the player
if char -4 to -1 of pUrl = ".mp3" then
mobileControlSet sPlayerId, "filename", pURL
//use the mobilecontroldo command to start playback
mobileControlDo sPlayerId, "play"
mobileControlSet sPlayerId, "visible", "true"
end if
end browserStartedLoading
//Delete Mobile Controls using mobilecontroldelete command
on closeCard
if the environment is "mobile" then
mobileControlDelete sBrowserId
mobileControlDelete sPlayerId
end if
------------------------------------------------
Thanks,
David
I was given a great start with the code below, but on android phones, when I play a mp3 file the screen goes black:
--------------------------------
local sBrowserId,sPlayerId
on preOpenCard
//check to make sure you're in the mobile environment
if the environment is "mobile" then
//set up native player named "SermonPlayer" and use mobilecontrolset to set it's visiblity,rect. etc
mobileControlCreate "player", "SermonPlayer"
put the result into sPlayerId
mobileControlSet sPlayerId, "visible","true"
//I used a grouped rectangle named "PlayerArea" to define the rect of my player
mobileControlSet sPlayerId, "rect", (the rect of grc "PlayerArea")
mobilecontrolset sPlayerId,"Showcontroller","true"
--mobileControlSet sPlayerId, "filename", "http://spokenwordchurch.com/mp3sermons/ ... School.mp3"
//Use the Mobilecontroldo command to play,stop, or pause the player
--mobileControlDo sPlayerId, "play"
//set up native browser set it's rect visibility and URL with mobilecontrolset
mobileControlCreate "browser"
put the result into sBrowserId
mobileControlSet sBrowserId, "rect", the rect of group "Browser"
mobileControlSet sBrowserId, "visible", "true"
mobileControlSet sBrowserId, "url", " http://covingtongoodnews.com/audio-downloads/"
//if the environment is not mobile then exit the handler
else
exit preopencard
end if
end preOpenCard
on browserStartedLoading pUrl
//when the browser tries to load a URL, if it is an MP3, then use the mobilecontrolset command to laod it into the player
if char -4 to -1 of pUrl = ".mp3" then
mobileControlSet sPlayerId, "filename", pURL
//use the mobilecontroldo command to start playback
mobileControlDo sPlayerId, "play"
mobileControlSet sPlayerId, "visible", "true"
end if
end browserStartedLoading
//Delete Mobile Controls using mobilecontroldelete command
on closeCard
if the environment is "mobile" then
mobileControlDelete sBrowserId
mobileControlDelete sPlayerId
end if
------------------------------------------------
Thanks,
David