You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi could you suggest the ideal way to maintain connection between activities.
I am defining the BluetoothController as static in main activity and defining a local as follows
public BluetoothController mBluetoothController = MainActivity.mBluetoothController;
and then using that object i read the incoming data
This works 90% of the time but i get this error at times
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.x/com.x.yActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void co.lujun.lmbluetoothsdk.BluetoothController.setBluetoothListener(co.lujun.lmbluetoothsdk.base.BluetoothListener)' on a null object reference
Do let me know how i can resolve this issue !!
The text was updated successfully, but these errors were encountered:
The best way to maintain a connection is to use controller API in a Thread/service that is able to survive to the Activity destroy.
Another solution (donno if could be applied to your case) is to implement a single Activity with 2 or more Fragments.
Hi could you suggest the ideal way to maintain connection between activities.
I am defining the BluetoothController as static in main activity and defining a local as follows
public BluetoothController mBluetoothController = MainActivity.mBluetoothController;
and then using that object i read the incoming data
mBluetoothController.setBluetoothListener(new BluetoothListener() { ... }
This works 90% of the time but i get this error at times
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.x/com.x.yActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void co.lujun.lmbluetoothsdk.BluetoothController.setBluetoothListener(co.lujun.lmbluetoothsdk.base.BluetoothListener)' on a null object reference
Do let me know how i can resolve this issue !!
The text was updated successfully, but these errors were encountered: