Android 蓝牙适配器问题?
我只是在写下面的代码,在“mBtAdapter.startDiscovery();”上遇到了一些问题,我不明白到底发生了什么,我只想启动蓝牙并在加载应用程序时将设备添加到阵列中Android 蓝牙适配器问题?,android,bluetooth,Android,Bluetooth,我只是在写下面的代码,在“mBtAdapter.startDiscovery();”上遇到了一些问题,我不明白到底发生了什么,我只想启动蓝牙并在加载应用程序时将设备添加到阵列中 package com.wiztech.veer; import android.app.Activity; import android.bluetooth.BluetoothAdapter; import android.os.Bundle; import android.widget.ArrayAdapter;
package com.wiztech.veer;
import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.os.Bundle;
import android.widget.ArrayAdapter;
public class BLU_TESTActivity extends Activity {
// Member fields
private BluetoothAdapter mBtAdapter;
private ArrayAdapter<String> mPairedDevicesArrayAdapter;
private ArrayAdapter<String> mNewDevicesArrayAdapter;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Get the local Bluetooth adapter
mBtAdapter = BluetoothAdapter.getDefaultAdapter();
mBtAdapter.startDiscovery();
}
}
请帮忙 您已尝试broadcastReceiver(),或者您可能在manifest.xml中缺少权限
07-26 13:21:52.178: ERROR/AndroidRuntime(4962): ERROR: thread attach failed
07-26 13:21:53.518: ERROR/ActivityManager(117): fail to set top app changed!
07-26 13:21:53.668: ERROR/AndroidRuntime(4970): ERROR: thread attach failed