Paso 9: Añadir contenido en scanOnClick
if(!isConnected){ bleDeviceListView.setAdapter(bluetoothHandler.getDeviceListAdapter)); bleDeviceListView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView parent, View view, int position, long id) { String buttonText = (String) ((Button)v).getText(); if(buttonText.equals("scanning")){ showMessage("scanning..."){ return ; } BluetoothDevice device = bluetoothHandler.getDeviceListAdapter().getItem(position).device; // connect bluetoothHandler.connect(device.getAddress()); } }); bluetoothHandler.setOnScanListener(new OnScanListener() { public void onScanFinished() { // TODO Auto-generated method stub ((Button)v).setText("scan"); ((Button)v).setEnabled(true); } public void onScan(BluetoothDevice device, int rssi, byte[] scanRecord) {} }); ((Button)v).setText("scanning"); ((Button)v).setEnabled(false); bluetoothHandler.scanLeDevice(true); }else{ setConnectStatus(false);
}