package com.example.zzaier.myapplication; import android.content.Intent; import android.os.AsyncTask; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.TextView; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; public class Main4Activity extends AppCompatActivity { String InfoReceivedManager, id, fname, lname; TextView out1, out2,out3; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main4); Intent myNewIntent=getIntent(); InfoReceivedManager=myNewIntent.getStringExtra("theManager"); System.out.println(InfoReceivedManager); out1 =(TextView) findViewById(R.id.textView1); out2 =(TextView) findViewById(R.id.textView2); out3 =(TextView) findViewById(R.id.textView3); new MyTask().execute(); } private class MyTask extends AsyncTask { @Override protected Void doInBackground(Void... params) { URL url = null; try { url = new URL("http://ziedzaier.com/wp-content/uploads/2018/10/employeesList.txt"); HttpURLConnection client = null; client = (HttpURLConnection) url.openConnection(); client.setRequestMethod("GET"); int responseCode = client.getResponseCode(); System.out.println("\n Sending 'GET' request to URL : " + url); System.out.println("Response Code : " + responseCode); InputStreamReader myInput = new InputStreamReader(client.getInputStream()); BufferedReader in = new BufferedReader(myInput); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); //print result System.out.println("The response is "+response.toString()); JSONObject mainObject = new JSONObject(response.toString()); JSONArray employees = mainObject.getJSONArray("employees"); int i=0; String employeeFullName=""; while(i