Created
December 24, 2019 10:52
-
-
Save sidishere/fefbeb8b5c902ec9af28efb2dce76b2c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private AdapterView.OnItemClickListener mDeviceClickListener= new AdapterView.OnItemClickListener() | |
{ | |
public void onItemClick(AdapterView<?> av, View v, int arg2, long arg3) | |
{ | |
// Cancel discovery because it's costly and we're about to connect | |
bluetoothAdapter.cancelDiscovery(); | |
Toast.makeText(getApplicationContext(),"Stopping discovery",Toast.LENGTH_SHORT).show(); | |
// Get the device MAC address, which is the last 17 chars in the View String | |
info = ((TextView) v).getText().toString(); | |
String address = info.substring(info.length() - 17); | |
// Create the result Intent and include the MAC address Intent | |
intent = new Intent(BluetoothActivity.this,LedControl.class); | |
intent.putExtra("DEVICE_ADDRESS", address); | |
// Set result and finish this Activity | |
startActivity(intent); | |
} | |
} | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment