Fragment spinner doesn't stop in Android
<p>I use this code to load the nearby places of any particular location by setting the** data using an Array Adapter. There are two issues that I face:
1. The spinner doesn't stop even after the data is loaded. (There should be no spinner. But I am not sure how does Fragment when it comes to this.)</p>

<ol>
<li><p>I'm going to implement AsyncTask to get the places so that it doesn't slow down the Activity. The mini problem I face is this: How do I notify the user (update the view) with new date when he/she has changed his location. Let's assume that that the user is walking. Thus the lat/lon will change. So, how can I use onChangeNotify() and change the value of the List.  </p>

<p>public class FragmentMap extends ListFragment  {</p>

<pre><code>    ArrayList&lt;Place&gt; places = new ArrayList&lt;Place&gt;();
    //List&lt;String&gt; val = new List&lt;String&gt;()
    //@InjectView(R.id.explorePlacesListView) ListView placesListView;
    ListView listView;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);


    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);


            ListView listView = (ListView) getActivity().findViewById(R.id.explorePlacesListView);
        getPlaces();

        PlacesAdapter placesAdapter = new PlacesAdapter(getActivity(),R.layout.user_list_item, places);
        listView.setAdapter(placesAdapter);
    }



    public void getPlaces(){

         URL yahoo;
         String key,latitude,longitude;
         key = "AIzaSyAZgD01sj3jssaYCmkLL8c7Z4qPTEdt6xU";
         latitude = "37.77264";
         longitude ="-122.409915";
        try {

            yahoo = new URL("https://maps.googleapis.com/maps/api/place/search/json?location=-33.8670522,151.1957362&amp;radius=500&amp;sensor=false&amp;key=AIzaSyB2SGEmOLDGB_f0bp1PGTjQqTw2VuDcaM8");
            URLConnection yc = yahoo.openConnection();
            BufferedReader in = new BufferedReader(
                                    new InputStreamReader(
                                    yc.getInputStream()));
            String inputLine;
            String jsonLine = new String();
            while ((inputLine = in.readLine()) != null) {
                    Log.d("inputLine",inputLine);

                    jsonLine = jsonLine + inputLine;
        }
            in.close();
            Object jsonResponse = parseResponse(jsonLine);
            parseJSONPlaces((JSONObject)jsonResponse);
        } catch (MalformedURLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

    protected Object parseResponse(String responseBody) throws JSONException {
        return new JSONTokener(responseBody).nextValue();
    }

 private void parseJSONPlaces(JSONObject json){

     try {
    JSONArray jsonArray =   json.getJSONArray("results");

    for (int j = 0; j &lt; json.length(); j++) {

        Place place = new Place();


        place.name = jsonArray.getJSONObject(j).getString("name");
        place.icon = jsonArray.getJSONObject(j).getString("icon");
       // JSONObject locationObject = jsonArray.getJSONObject(j).getJSONObject("location");
       // place.latitude = locationObject.getString("latitude");
       // place.longitude = locationObject.getString("longitude");
        Log.d("name",place.name);

        places.add(place);
    }
    } catch (JSONException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
      if(json.optJSONObject("results") != null){


        }



 }
</code></pre></li>
</ol>
