I'm doing a simple IRC client but i'm a little confused about using threads.
Now i've got 4 classes:
- one for the handler (to handle messages obviously),
- another for the UI that has a textEdit where to show everything that comes from the IRC server, as well as everything that you write to it.
- another one for the socket, to connect to the IRC server
- and finally, the "main" class.
This "main" class has a handler object, and launches 2 threads one for the UI class and another for the socket one.
This is done like this:
The ChatUI constructor is where i set the layout:
The problem is that my app crashes with a NullPointerException caused when I try to launch the UI thread.
I don't know the best way to do this, and I'll appreciate advice.
Thanks in antticipation.