Thank you! I have fixed some issues, but I still struggle at understanding these threads and async.
I have created a new parser inside the onPostExecute but it returns an error: java.lang.NullPointerException: Attempt to invoke virtual method 'int org.json.JSONArray.length()' on a null object reference
I believe that the parser does not work onPostExecute and should a background task as you suggested earlier but it did not work in the doInBackground either.
What can I do?