title: How to Sort Arraylisthashmap by latitude and longitude in android
body: <p>i am getting the flight arraylist using json parsing now i want to sort this arraylist by thier latitude and longitude but how can i sort this i know simple list sorting but no idea about the arraylist</p>
  
  <blockquote>
    <p>Home Activity.java</p>
  </blockquote>
  
  <pre><code>@override
  public class HomeActivity extends  Activity
  {
      public void oncreate { 
  
       new FlightListBack.execute();
  
  }
  
  public class FlightListBack extends AsyncTask&lt;String,ArrayList&lt; HashMap&lt;String,String&gt;&gt;, ArrayList&lt;HashMap&lt;String,String&gt;&gt;&gt; 
  {
      @Override
      protected ArrayList&lt;HashMap&lt;String,String&gt;&gt; doInBackground(
              String... params) {
      try
          {
          String spinnerstringfunction=jparser.getJSONFromUrl(airporturl);
          Log.e("SpinnerStringFunction","Count"+spinnerstringfunction);
  
          JSONObject jobject= new JSONObject(spinnerstringfunction); 
  
          // Airlines Array For Getting Airlines Name
          sjairport=jobject.getJSONArray(TAG_SAIRPORT);
  
          Log.e("Aysn sjairport","sss"+sjairport);
          for(int a=0;a&lt;sjairport.length();a++)
          {
  
              HashMap&lt;String, String&gt; spinnermap = new HashMap&lt;String, String&gt;();
              String spinnerfs=sjairport.getJSONObject(a).get(TAG_SPINNERFS).toString(); 
              String spinnername=sjairport.getJSONObject(a).get(TAG_SPINNERNAME).toString();
              String  spinnercity=sjairport.getJSONObject(a).get(TAG_SPINNERCITY).toString();
              String slatitude=sjairport.getJSONObject(a).get(TAG_SPINNERLATITUDE).toString();
              String slongitude=sjairport.getJSONObject(a).get(TAG_SPINNERLONGITUDE).toString();
  
              spinnermap.put(TAG_SPINNERFS, spinnerfs);
              spinnermap.put(TAG_SPINNERNAME,spinnername);
              spinnermap.put(TAG_SPINNERCITY,spinnercity);
              spinnermap.put(TAG_SPINNERLATITUDE,slatitude);
              spinnermap.put(TAG_SPINNERLONGITUDE, slongitude);
  
              spinnerAirportList.add(spinnermap);  
  
          }
  
          Log.e("Spinner Airport List","spinner"+spinnerAirportList);
  
      }
      catch (Exception e)
      {
              e.printStackTrace();
      }
  
      return spinnerAirportList;
  
  }
  protected void onPostExecute(final ArrayList&lt;HashMap&lt;String, String&gt;&gt; result )
  {
            other code for display listview
  
  }
  }
  </code></pre>