I got a BLE tutorial working. I can send and receive data on the SPS service, this data TX RX is done in Dialog_BTLE_Characteristics. It looks like the characteristics & services are passed from Activity_BTLE_Services to Dialog_BTLE_Characteristic class using the following commands.
Dialog_BTLE_Characteristic dialog_btle_characteristic = new Dialog_BTLE_Characteristic();
dialog_btle_characteristic.setTitle(uuid);
dialog_btle_characteristic.setService(mBTLE_Service);
dialog_btle_characteristic.setCharacteristic(characteristic);
then the characteristics are used in Dialog_BTLE_Characteristic class to send data (output):
characteristic.setValue(output);
service.writeCharacteristic(characteristic);
Now I want to send and receive data inside a Fragment. How do I pass that characteristics and services to the Fragment?
Your help will be great. Marinus
It it bad practice to do BLE operations in a fragment. Create a helper class that does the BLE operations and only send decoded data to fragments/actvities for display purposes.