-
-
Save grantges/e979dbbf0b817b0d2156 to your computer and use it in GitHub Desktop.
Android WebView not capturing Events - Example (TI SDK 3.1.1.GA)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script> | |
Ti.App.addEventListener("updatePage", function(e){ | |
Ti.API.info("captured event: "+e.text); | |
updateText(e.text) | |
}) | |
function updateText(t){ | |
var div = document.getElementById('myDiv'); | |
div.innerHTML = text; | |
} | |
</script> | |
</head> | |
<body> | |
Android Test | |
<div id="myDiv"></div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.webView.addEventListener('load', function(e){ | |
Ti.API.info("page loaded"); | |
Ti.App.fireEvent("updatePage", {text:"Hello WebView"}); | |
Ti.API.info('event fired'); | |
setTimeout(function(){ | |
$.webView.evalJS('updateText("Hello WebView from EvalJS")'); | |
}, 2000) | |
}); | |
$.webView.url ="/index.html" | |
$.index.open(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"#webView":{ | |
height: Ti.UI.FILL, | |
width: Ti.UI.FILL, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Alloy> | |
<Window class="container"> | |
<WebView id="webView" /> | |
</Window> | |
</Alloy> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment