I'm creating a chat app using socket and after developing the entire layout I decided to get into the connection part ... the problem is that when I get messages the app closes and it shows some errors ... I went through the debug and it tells me so much my adapter and my listview are null. I'm new to android and java.
follows a bit of error (line 224 is where adapterMessage.add (message)
E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
Process: com.stevenilson.appchat, PID: 26141
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:304)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void adapters.MessageAdapter.add(objetos.Message)' on a null object reference
at com.stevenilson.appchat.TelaDrawer.receive(TelaDrawer.java:224)
at AsyncTask.TaskConnect.doInBackground(TaskConnect.java:80)
at AsyncTask.TaskConnect.doInBackground(TaskConnect.java:26)
at android.os.AsyncTask$2.call(AsyncTask.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
If you need to see more of the project I have it in GitHub: link
Thank you in advance for anyone who can help me.