Android AsyncTask not executing when called second time
android, android-asynctask, json
Solution
Create a seperate instance of your async task and try to execute like this..
new MyAsyncTask().execute(params);
because The Asynctask can be executed only once (an exception will be thrown if a second execution is attempted)
Problem
I have a class which extends AsyncTask ``` public class SendJSONArray2Server extends AsyncTask<String, Void, HttpResponse> ``` the class send a JSONArray to the server and receives response as JSONArray. I have instantiated the class as follows ``` private SendJSONArray2Server sendJSON; String[] params = { "http://10.0.2.2:8084/xyz/abc",jsonArray.toString() }; sendJSON.execute(params); ``` In onPostExecute I process the user response ``` @Override protected void onPostExecute(HttpResponse response) ``` AsyncTask is executed first time like charm and I am receiving the response from the Server but when I try to send JSONArray to server for the second time AsyncTask does not execute. I am not getting any exceptions or errors in logcat.