Titanium 中 Intent 的 getStringArrayListExtra (Appcelerator)
为了在 Android 上使用语音识别 Intent,我需要能够在活动结果回调中对 Intent 调用 getStringArrayListExtra
。不幸的是,Titanium 的 意图类。有谁知道尽管这种方法不存在,我如何才能获取这些数据?
这是我的代码:
var intent = Ti.Android.createIntent({
action: FOTT.VoiceRecognizer.ACTION_RECOGNIZE_SPEECH
});
/* ...snip... */
Ti.Android.currentActivity.startActivityForResult(intent, function(event) {
if (event.resultCode == Ti.Android.RESULT_OK) {
var results = event.intent.getStringArrayListExtra("android.speech.extra.RESULTS");
console.log(results);
}
});
In order to use the speech recognition intent on Android, I need to be able to call getStringArrayListExtra
on the intent in the activity result callback. Unfortunately, it looks like Titanium doesn't have a wrapper for this method in its Intent class. Does anyone know how I can go about getting this data despite this method not existing?
Here's my code:
var intent = Ti.Android.createIntent({
action: FOTT.VoiceRecognizer.ACTION_RECOGNIZE_SPEECH
});
/* ...snip... */
Ti.Android.currentActivity.startActivityForResult(intent, function(event) {
if (event.resultCode == Ti.Android.RESULT_OK) {
var results = event.intent.getStringArrayListExtra("android.speech.extra.RESULTS");
console.log(results);
}
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,Titanium 的 Intent Proxy 不包含此方法的包装器。因此,我编写了一个 自定义模块 来解决该问题。
It turns out Titanium's Intent Proxy does not include a wrapper for this method. As such, I wrote a custom module to solve the problem.