简体   繁体   English

如何从Android将数据放入人行横道

[英]How to get data into crosswalk from Android

I know we can get data from the Crosswalk HTML into android and toast it. 我知道我们可以将Crosswalk HTML中的数据导入android并进行烘烤。 But I have data from Android that I'd like to pass to the Javascript running in Crosswalk View. 但是我有来自Android的数据,希望传递给在Crosswalk View中运行的Javascript。 Any way to work around this ? 有什么办法解决这个问题?

like using the gyroscope feed straight into the HTML or even bluetooth data? 例如使用陀螺仪直接输入HTML甚至是蓝牙数据?

Got it, @JavaScriptInterface was used to call a function in native. 知道了,@ JavaScriptInterface被用来在本地调用一个函数。 So write a native function to return a String back to the javascript code on your html. 因此,编写一个本机函数以将String返回到html上的javascript代码。 For some weird reason returning int isnt working but strings work fine. 由于某些奇怪的原因,返回int无效,但是字符串可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM