Back to project page blue-tool-box.
The source code is released under:
Apache License
If you think the Android project blue-tool-box listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.eperu.bluemessenger; //ww w. j a v a2 s . c om import android.app.Activity; import android.bluetooth.BluetoothDevice; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; public class BluetoothDeviceDetailsActivity extends Activity { /** * Valeur du header du dtail BlueTooth. */ private TextView deviceNameValue, deviceAdressValue, deviceBluetoothClassValue, deviceBondStateLabelValue; BluetoothManager bm; private Button boundBtn; private LinearLayout linearLayout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.bluetooth_device_details); this.linearLayout = (LinearLayout) this.findViewById(R.id.deviceDetailHeader); this.deviceNameValue = (TextView) this.findViewById(R.id.deviceNameValue); this.deviceAdressValue = (TextView) this.findViewById(R.id.deviceAdressValue); this.deviceBluetoothClassValue = (TextView) this.findViewById(R.id.deviceBluetoothClassValue); this.deviceBondStateLabelValue = (TextView) this.findViewById(R.id.deviceBondStateLabelValue); this.boundBtn = (Button) this.findViewById(R.id.boundBtn); BluetoothDevice bd = (BluetoothDevice) this.getIntent().getExtras().get("device"); if (BluetoothDevice.DEVICE_TYPE_LE == bd.getType()) { this.deviceNameValue.setText(bd.getName() + " iBeacon"); } else { this.deviceNameValue.setText(bd.getName()); } this.deviceAdressValue.setText(bd.getAddress()); this.deviceBluetoothClassValue.setText("" + bd.getBluetoothClass().getDeviceClass()); String state = "Non Connect"; if (BluetoothDevice.BOND_BONDING == bd.getBondState()) { state = "En cours de connexion..."; } else if (BluetoothDevice.BOND_BONDED == bd.getBondState()) { } else { this.boundBtn.setVisibility(View.VISIBLE); } this.deviceBondStateLabelValue.setText(state); this.boundBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { } }); } }