如果你看到「Uno」遊戲,你會得到一些想法。在那裏,他們沒有使用藍牙,而是使用WiFi。 從中我學到了,以及其他一些等待連接成功的藍牙遊戲。
如果您使用BluetoothChat應用程序作爲參考,然後使用您的Handler作爲您的事件生成器來啓動您的遊戲。
// The Handler that gets information back from the BluetoothChatService
private final Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case MESSAGE_STATE_CHANGE:
if(D) Log.i(TAG, "MESSAGE_STATE_CHANGE: " + msg.arg1);
switch (msg.arg1) {
case BluetoothChatService.STATE_CONNECTED:
setStatus(getString(R.string.title_connected_to, mConnectedDeviceName));
mConversationArrayAdapter.clear();
// DO YOUR ACTIVITY HERE .. ..
// May Be like ... Intent intent = new Intent(...)
break;
非常感謝! :d – AbAetherno 2013-05-12 18:34:04