保持连接状态?
|
在蓝牙聊天示例中,我想添加另一个活动。建立连接时以及加载新活动时,如何仍保持连接活动?
加载新活动后,将调用onStop方法,并使用之前建立的连接来固定发送消息。我在新活动中尝试了以下代码:
BluetoothChat bt = new BluetoothChat();
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.special_keys);
bt.sendMessage(\"hello\");
}
我设法发送了\“ hello \”,但此后它强制关闭。.必须有一种有效的方法来处理这种情况。请帮忙。
提前致谢。
没有找到相关结果
已邀请:
1 个回复
厢界山攀