Android中的蓝牙处理程序-仅运行一次

时间:2019-01-28 16:29:51

标签: java android android-studio bluetooth

嗨,我想让两个 Case语句仅运行一次。如何使conda env update -f=environment.ymlPLAYER_GAMEPIECE_WRITE Case语句像PLAYER_GAMEPIECE_READ case一样只运行一次?他们似乎只是彼此循环。它不会继续进行下一种情况。

处理程序代码:

MESSAGE_DEVICE_NAME

BluetoothService代码:

private Handler mHandler = new Handler() {
    @Override
    public void handleMessage(final Message msg)
    {
        switch (msg.what)
        {

            // If the two devices are connected
            case MESSAGE_DEVICE_NAME:
                mConnectedDeviceName = msg.getData().getString(DEVICE_NAME);

                Toast.makeText(TwoPlayerActivityBluetooth.this, "Connected to " + mConnectedDeviceName, Toast.LENGTH_SHORT).show();

            case PLAYER_GAMEPIECE_WRITE:
                //INSERT CODE HERE
                break;

            case PLAYER_GAMEPIECE_READ:
                //INSERT CODE HERE
                break;

            case PLAYER_LOCATION_WRITE:
                //INSERT CODE HERE
                break;

            case PLAYER_LOCATION_READ:
                //INSERT CODE HERE 
                break;

0 个答案:

没有答案