Activity has leaked windows that was originally added here
<p>Basically I am getting this error and I am not sure what part of the code is causing it, just looking for some advice on what is wrong, thanks.                                                                                                                                                                     .   </p>

<pre><code>   public class ViewHole extends ListActivity {

// Progress Dialog
private ProgressDialog pDialog;

// Creating JSON Parser object
JSONParser jParser = new JSONParser();

ArrayList&lt;HashMap&lt;String, String&gt;&gt; holesList;


// url to get all products list
private static String url_all_holes = "http://localhost/realdeal/get_hole_details.php";

// JSON Node names
private static final String TAG_SUCCESS = "success";
private static final String TAG_COURSEONE = "courseone";
private static final String TAG_HOLENUMBER = "holenumber";
private static final String TAG_INDEX = "index";
private static final String TAG_YARDAGE = "yardage";
private static final String TAG_PAR = "par";

// products JSONArray
JSONArray courseone = null;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.viewhole);

    // Hashmap for ListView
    holesList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();

    // Loading products in Background Thread
    new loadallholes().execute();



/**
 * Background Async Task to Load all holes by making HTTP Request
 * */
class loadallholes extends AsyncTask&lt;String, String, String&gt; {

    /**
     * Before starting background thread Show Progress Dialog
     * */
    @Override
    protected void onPreExecute() {
        super.onPreExecute();
        pDialog = new ProgressDialog(ViewHole.this);
        pDialog.setMessage("Loading holes. Please wait...");
        pDialog.setIndeterminate(false);
        pDialog.setCancelable(false);
        pDialog.show();
    }

    /**
     * getting All holes from url
     * */
    protected String doInBackground(String... args) {
        // Building Parameters
        List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;();
        // getting JSON string from URL
        JSONObject json = jParser.makeHttpRequest(url_all_holes, "GET", params);

        // Check your log cat for JSON response
        Log.d("All Holes: ", json.toString());

        try {
            // Checking for SUCCESS TAG
            int success = json.getInt(TAG_SUCCESS);

            if (success == 1) {
                // holes found
                // Getting Array of hole numbers
                courseone = json.getJSONArray(TAG_COURSEONE);

                // looping through All holes
                for (int i = 0; i &lt; courseone.length(); i++) {
                    JSONObject c = courseone.getJSONObject(i);

                    // Storing each json item in variable
                    String holenumber = c.getString(TAG_HOLENUMBER);
                    String index = c.getString(TAG_INDEX);
                    String yardage = c.getString(TAG_YARDAGE);
                    String par = c.getString(TAG_PAR);




                    // creating new HashMap
                    HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();

                    // adding each child node to HashMap key =&gt; value
                    map.put(TAG_HOLENUMBER, holenumber);
                    map.put(TAG_INDEX, index);
                    map.put(TAG_YARDAGE, yardage);
                    map.put(TAG_PAR, par);





                    // adding HashList to ArrayList
                    holesList.add(map);
                }
            } 


        } catch (JSONException e) {
            e.printStackTrace();
        }

        return null;
    }

    /**
     * After completing background task Dismiss the progress dialog
     * **/
    protected void onPostExecute(String file_url) {
        // dismiss the dialog after getting all products

        pDialog.dismiss();
        // updating UI from Background Thread
        runOnUiThread(new Runnable() {
            public void run() {
                /**
                 * Updating parsed JSON data into ListView
                 * */
                ListAdapter adapter = new SimpleAdapter(
                        ViewHole.this, holesList,
                        R.layout.list_item, new String[] { TAG_HOLENUMBER, TAG_INDEX, TAG_YARDAGE, TAG_PAR},                            
                        new int[] { R.id.holenumber, R.id.index, R.id.yardage, R.id.par });

                // updating listview
                setListAdapter(adapter);
            }
        });

    }

}
</code></pre>

<p>}</p>

<p>Logcat errors - </p>

<pre><code>01-27 04:11:57.228: E/WindowManager(3566): Activity com.example.golfapp.ViewHole has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{40cdf768 V.E..... R.....ID 0,0-684,192} that was originally added here
01-27 04:11:57.228: E/WindowManager(3566): android.view.WindowLeaked: Activity com.example.golfapp.ViewHole has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{40cdf768 V.E..... R.....ID 0,0-684,192} that was originally added here
01-27 04:11:57.228: E/WindowManager(3566):  at android.view.ViewRootImpl.&lt;init&gt;(ViewRootImpl.java:354)
01-27 04:11:57.228: E/WindowManager(3566):  at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:216)
01-27 04:11:57.228: E/WindowManager(3566):  at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
01-27 04:11:57.228: E/WindowManager(3566):  at android.app.Dialog.show(Dialog.java:281)
01-27 04:11:57.228: E/WindowManager(3566):  at com.example.golfapp.ViewHole$loadallholes.onPreExecute(ViewHole.java:121)
01-27 04:11:57.228: E/WindowManager(3566):  at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:586)
01-27 04:11:57.228: E/WindowManager(3566):  at android.os.AsyncTask.execute(AsyncTask.java:534)
01-27 04:11:57.228: E/WindowManager(3566):  at com.example.golfapp.ViewHole.onCreate(ViewHole.java:61)
01-27 04:11:57.228: E/WindowManager(3566):  at android.app.Activity.performCreate(Activity.java:5104)
01-27 04:11:57.228: E/WindowManager(3566):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
01-27 04:11:57.228: E/WindowManager(3566):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
01-27 04:11:57.228: E/WindowManager(3566):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
01-27 04:11:57.228: E/WindowManager(3566):  at android.app.ActivityThread.access$600(ActivityThread.java:141)
01-27 04:11:57.228: E/WindowManager(3566):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
01-27 04:11:57.228: E/WindowManager(3566):  at android.os.Handler.dispatchMessage(Handler.java:99)
01-27 04:11:57.228: E/WindowManager(3566):  at android.os.Looper.loop(Looper.java:137)
01-27 04:11:57.228: E/WindowManager(3566):  at android.app.ActivityThread.main(ActivityThread.java:5039)
01-27 04:11:57.228: E/WindowManager(3566):  at java.lang.reflect.Method.invokeNative(Native Method)
01-27 04:11:57.228: E/WindowManager(3566):  at java.lang.reflect.Method.invoke(Method.java:511)
01-27 04:11:57.228: E/WindowManager(3566):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
01-27 04:11:57.228: E/WindowManager(3566):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
01-27 04:11:57.228: E/WindowManager(3566):  at dalvik.system.NativeStart.main(Native Method)
</code></pre>

<p>JSON class -</p>

<pre><code>      public class JSONParser {

static InputStream is = null;
static JSONObject jObj = null;
static String json = "";

// constructor
public JSONParser() {

}

// function get json from url
// by making HTTP POST or GET mehtod
public JSONObject makeHttpRequest(String url, String method,
        List&lt;NameValuePair&gt; params) {

    // Making HTTP request
    try {

        // check for request method
        if(method == "POST"){
            // request method is POST
            // defaultHttpClient
            DefaultHttpClient httpClient = new DefaultHttpClient();
            HttpPost httpPost = new HttpPost(url);
            httpPost.setEntity(new UrlEncodedFormEntity(params));

            HttpResponse httpResponse = httpClient.execute(httpPost);
            HttpEntity httpEntity = httpResponse.getEntity();
            is = httpEntity.getContent();

        }else if(method == "GET"){
            // request method is GET
            DefaultHttpClient httpClient = new DefaultHttpClient();
            String paramString = URLEncodedUtils.format(params, "utf-8");
            url += "?" + paramString;
            HttpGet httpGet = new HttpGet(url);

            HttpResponse httpResponse = httpClient.execute(httpGet);
            HttpEntity httpEntity = httpResponse.getEntity();
            is = httpEntity.getContent();
        }           


    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    } catch (ClientProtocolException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    try {
        BufferedReader reader = new BufferedReader(new InputStreamReader(
                is, "iso-8859-1"), 8);
        StringBuilder sb = new StringBuilder();
        String line = null;
        while ((line = reader.readLine()) != null) {
            sb.append(line + "\n");
        }
        is.close();
        json = sb.toString();
    } catch (Exception e) {
        Log.e("Buffer Error", "Error converting result " + e.toString());
    }

    // try parse the string to a JSON object
    try {
        jObj = new JSONObject(json);
    } catch (JSONException e) {
        Log.e("JSON Parser", "Error parsing data " + e.toString());
    }

    // return JSON String
    return jObj;

}
</code></pre>

<p>}</p>
