I am building a BTchat application project in android studio, The first activity sets up the connection and after the devices are connected we move to the next activity. I have used an application class with methods like getBTSocket() and setBTSocket(). In the second activity when there is the call of getBTSocket() my app closes/crashes(whatever you may call it).
Here is the code for socket.
public void setBluetoothSocket ( BluetoothSocket socket1 ) {
socket = socket1;
}
public BluetoothSocket getBTSocket() {
return socket;
}
Please tell me what should I do.