Open kky5201314y opened 9 years ago
At Last , i use "public static BluetoothSPP bt;" to made it work on deffrent Activitys.
But , i want to know any other solution.
Thank you for the update of your original post. I would like to use this library across two different activities. I would like each activity to have its own behavior and its own "setOnDataReceivedListener". This seems to be giving me problems that I can't resolve. I am new to android programming. Should I just have one instance of "setOnDataReceivedListener" and pass the information between activities? Or something else? Any help here would be appreciated. Thanks in advance.
Okay, I think I've figures this out for myself and thought I would post what I have learned here for others to learn from. (Or correct me if I am wrong.)
When starting a new activity a method can be overridden. In this case I am overriding the "setOnDataReceivedListener" method to do something different in the new activity. When the user pressed the back button to return to the previous activity the overridden method exists and should be restored. This can be done in one of two ways:
please help i have same issue but i don't understand what have you done
I got three Activitys.
"MainActivity" is for init SDK. "DeviceListActivity" is for finding bluetooth-device. "DataSendActivity" is for sending data and show data recived.
And, my problem is "DataSendActivity" is not able to use.
I have look into Library's sample, but there is no solution.
Please help me.