I apologize in advance for a possible Nubian question, new to java) and there are no normal tutorials on socket.io. With Google, I tried to start learning and it seemed to work out something (the application at least starts xD), but when I press the button on the form and Connect is done, then crash with an error
java.lang.NullPointerException: Attempt to invoke virtual method 'io.socket.client.Socket io.socket.client.Socket.connect()' on a null object reference That's what happened) can you explain what is wrong?
public class LoginActivity extends AppCompatActivity { private Socket mSocket; { try { mSocket = IO.socket("192.168.100.3:8080"); } catch (URISyntaxException e) {} }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); } public void Connect(View v){ mSocket.connect(); }; }
http://before the ip address - EvillNooB