fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
try {
String host = "192.168.4.1";
int port = 2390;
byte[] message = "Som tu".getBytes();
InetAddress address = InetAddress.getByName(host);
DatagramPacket packet = new DatagramPacket(message, message.length, address, port);
DatagramSocket dSocket = new DatagramSocket();
dSocket.send(packet);
dSocket.close();
}
catch(Exception e){
speak("error");
}
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS,3);
mySpeechRecognizer.startListening(intent);
}
});
我正在尝试创建 android 应用程序,该应用程序将在按下按钮时通过 udp 发送文本,但它总是最终被捕获..任何想法为什么?我也得到 Error: E/HAL: load: id=gralloc != hmi->id=gralloc 但我不知道如何解决它。有没有我忘记的许可?我只使用(RECORD_AUDIO,INTERNET)
拉丁的传说
相关分类