You're accessing to the Main thread in doInBackground
method of AsyncTask
when:
@Override
protected String doInBackground(String... params) {
ServerAPI.receiveMessage(t.getText().toString());
return "Executed";
}
Do you get the error if you comment the first line of code within doInBackground
?
Avoid that and try to get those values before in onPreExecute
, in doInBackground
as params
String parameter, or passing to the AsyncTask constructor.