Android BT扫描(无法在TextView中显示)

时间:2013-12-12 08:02:03

标签: android

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);
      }
   }
 }

1 个答案:

答案 0 :(得分:0)

你确定调用了onReceive函数吗?尝试在里面打印一些调试文本。

如果被调用,请尝试添加

out = (TextView) findViewById (R.id.deviceName);
out.setText(device.getName());
out.invalidate(); // Add this