Javaを使用するAndroidでBluetoothデバイス名を表示するには? 参照するコードはありますか?
24448 次
1 に答える
18
以下のコードは、Bluetooth 名を取得します。ここでmBluetoothAdapter
は、タイプはBluetoothAdapter
です。
public String getLocalBluetoothName(){
if(mBluetoothAdapter == null){
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
}
String name = mBluetoothAdapter.getName();
if(name == null){
System.out.println("Name is null!");
name = mBluetoothAdapter.getAddress();
}
return name;
}
于 2011-07-12T09:48:16.107 に答える