Android, synctask not showing the list after progressDialog
<p>I was using AsyncTask to display data on a List, But the loading is visible, but it dosen't show the list.. </p>

<pre><code>  public void getLocations(){
    Connect client = new Connect(SERVICE_URI + "/GetLocations");
    client.AddHeader("Accept", "application/json");
    client.AddHeader("Content-Type", "application/json");

    try {
        client.Execute(RequestMethod.GET);
        JSONObject rootJson = new JSONObject(client.getResponse());
        JSONArray jsonArray = rootJson.getJSONArray("GetLocationsResult");

        String[] names = null;
        if (jsonArray != null) {
            names = new String[jsonArray.length()];
            for (int i = 0; i &lt; jsonArray.length(); i++) {
                JSONObject json = jsonArray.getJSONObject(i);
                names[i] = json.getString("Name");
            }
        }

        setListAdapter(new ArrayAdapter&lt;String&gt;(this,
                android.R.layout.simple_list_item_1, names));
    } catch (JSONException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
}


  public void getLocations(){
 Connect client = new Connect(SERVICE_URI + "/GetLocations");
    client.AddHeader("Accept", "application/json");
    client.AddHeader("Content-Type", "application/json");

    try {
     client.Execute(RequestMethod.GET);
     JSONObject rootJson = new JSONObject(client.getResponse());
     JSONArray jsonArray = rootJson.getJSONArray("GetLocationsResult");

     String[] names = null;
     if (jsonArray != null) {
         names = new String[jsonArray.length()];
         for (int i = 0; i &lt; jsonArray.length(); i++) {
             JSONObject json = jsonArray.getJSONObject(i);
             names[i] = json.getString("Name");
         }
     }

        setListAdapter(new ArrayAdapter&lt;String&gt;(this,
                android.R.layout.simple_list_item_1, names));
    } catch (JSONException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
</code></pre>
