Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android BT扫描(无法在文本视图中显示)_Android - Fatal编程技术网

Android BT扫描(无法在文本视图中显示)

Android BT扫描(无法在文本视图中显示),android,Android,是否确实调用了onReceive函数?尝试在内部打印一些调试文本 如果调用它,请尝试添加 final BroadcastReceiver ActionFoundReceiver1 = new BroadcastReceiver(){ @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if(BluetoothD

是否确实调用了onReceive函数?尝试在内部打印一些调试文本

如果调用它,请尝试添加

final BroadcastReceiver ActionFoundReceiver1 = new BroadcastReceiver(){
   @Override
   public void onReceive(Context context, Intent intent) {
      String action = intent.getAction();
      if(BluetoothDevice.ACTION_FOUND.equals(action)) {
         BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
         out = (TextView) findViewById (R.id.deviceName);
         out.setText(device.getName());
         btDeviceList.add(device);
      }
   }
 }

您的问题是什么?当我打开应用程序并进行扫描时,它在我的文本视图中没有显示任何内容。@Cindy2011,请编辑您的原始问题并包含必要的信息。
out = (TextView) findViewById (R.id.deviceName);
out.setText(device.getName());
out.invalidate(); // Add this