我开始意图然后等待结果。它在简短的演讲中效果很好,但是如果演讲时间太长,它并不能给我答案。(近1分钟)
final Intent searchIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
searchIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "tr");
searchIntent.putExtra(RecognizerIntent.EXTRA_PROMPT, true);
searchIntent.putExtra(RecognizerIntent.EXTRA_ONLY_RETURN_LANGUAGE_PREFERENCE, true);
startActivityForResult(searchIntent, VOICE_REQUEST_CODE);
Run Code Online (Sandbox Code Playgroud)
除了SpeechRecognizer之外,还有其他方法可以从ACTION_RECOGNIZE_SPEECH意向中获取结果吗?
我想将我的 firebase 数据对象映射到我的 pojo。但是,我的 firebase 对象属性名称是蛇形大小写,例如;“用户名”。我想在我的 pojo 上使用 camelCase,例如;“用户名”
我找到了这样一个漂亮的答案,但是,我找不到任何关于snake_case 到camelCase 映射的示例。
我的 pojo;
@SerializedName("content")
private String content;
@SerializedName("user_name")
private String userName;
Run Code Online (Sandbox Code Playgroud)
我正在使用以下代码行进行映射。'content' 匹配没有问题(有或没有 @SerializedName 注释),但 userName 保持为空。
Story story = storySnapshot.getValue(Story.class);
这也是混淆的一个问题。是否有一种优雅的方式将数据与 pojo 匹配?
java android type-conversion firebase firebase-realtime-database