Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to invoke virtual method 'java.io.OutputStream me.aflak.bluetooth.Bluetooth$ReceiveThread.getOutputStream()' on a null object reference #38

Closed
kvnramirez opened this issue May 30, 2019 · 2 comments

Comments

@kvnramirez
Copy link

Hi, I'm trying to send a message inmediately after the device is connected, but keeps throwing this error:

java.lang.NullPointerException: Attempt to invoke virtual method 'java.io.OutputStream me.aflak.bluetooth.Bluetooth$ReceiveThread.getOutputStream()' on a null object reference

I'm sending it on DeviceCallback using onDeviceConnected function

override fun onDeviceConnected(device: BluetoothDevice) {
statusMessage?.text = getString(R.string.connected)
bluetooth?.send("3")
}

I need to sent the value inmediately after connection to start to read sensors from an arduino

@omaraflak
Copy link
Owner

omaraflak commented May 31, 2019

Hi, please post the code of your Activity.

What kind of bluetooth module do you have ? Is it BLE or not ? This library does not support BLE devices.

Also take a look at that example : https://github.com/OmarAflak/Bluetooth-Library/blob/master/app/src/main/java/me/aflak/libraries/ChatActivity.java

@omaraflak
Copy link
Owner

This issue was solved in the new version :

implementation 'me.aflak.libraries:bluetooth:1.3.7'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants