小编hua*_*ang的帖子

蓝牙配对和连接设备

我想配对设备并连接它,但我有一个问题,我只能配对设备,但我无法连接它们.我想知道如何解决这个问题.我很害怕,我没有很好地解释我的问题,我无法连接手段,将手机连接到蓝牙耳机我只能配对,这里是代码

 if (btAdapt.isEnabled()) {
                    tbtnSwitch.setChecked(false);
            } else {
                    tbtnSwitch.setChecked(true);
            }
            // ============================================================

            IntentFilter intent = new IntentFilter();
            intent.addAction(BluetoothDevice.ACTION_FOUND);
            intent.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
            intent.addAction(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED);
            intent.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
            registerReceiver(searchDevices, intent);
    }

    private BroadcastReceiver searchDevices = new BroadcastReceiver() {

            public void onReceive(Context context, Intent intent) {
                    String action = intent.getAction();
                    Bundle b = intent.getExtras();
                    Object[] lstName = b.keySet().toArray();


                    for (int i = 0; i < lstName.length; i++) {
                            String keyName = lstName[i].toString();
                            Log.e(keyName, String.valueOf(b.get(keyName)));
                    }
                    BluetoothDevice device = null;

                    if (BluetoothDevice.ACTION_FOUND.equals(action)) {
                            device = intent
                                            .getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
                            if (device.getBondState() …
Run Code Online (Sandbox Code Playgroud)

android bluetooth connect

4
推荐指数
1
解决办法
1万
查看次数

android textview 值

我有一些问题

我想更改我的 textview 值。当我的代码改变时它会改变

这是代码

public class SubMenuActivity extends Activity {
private static final int GALLERY = 0;
private static final int SUBMANU01 = 7;
private static final int MANU01 = 1;
private static final int MANU02 = 2;
private static final int MANU03 = 3;
private static final int MANU04 = 4;
private static final int MANU05 = 5;
TextView tx1;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    tx1 …
Run Code Online (Sandbox Code Playgroud)

android textview

1
推荐指数
1
解决办法
6084
查看次数

标签 统计

android ×2

bluetooth ×1

connect ×1

textview ×1