-
Notifications
You must be signed in to change notification settings - Fork 39
Description
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 !!