java.lang.NullPointerException on most bluetooth calls
Hello I tried around with bluetooth_chat.py. Got it working except for the return message. Boiled down the problem to the few lines seen in the attached file.
bluetooth_error_example.py.txt
There is another app that establishes connection, and this works and the bluetoothWrite call works. Then essentially it refuses to read or to stop with java.lang.NullPointerException error. But dir(droid) reports these methods to be present.
This is Qpython3 installed from google play on Android 4.2.2 (Samsung GT-S7580)
Would greatly appreciate any pointers on how to proceed.
Well, to cut a long story short, this is the solution I found: https://github.com/kuri65536/python-for-android
Hi, I have the same problem when I tried to receive message from bluetooth. Here is my code.
import androidhelper
droid = androidhelper.Android()
droid.toggleBluetoothState(True)
cnRst = droid.bluetoothConnect()
while True:
message = droid.bluetoothReadLine().result
print(message)
droid.exit()
The error is same as yours. Could you teach me how to solve this error? Thank you so much.