我正在使用json解析获得飞行arraylist现在我想通过他们的纬度和经度对这个arraylist进行排序但是我怎么能排序这个我知道简单列表排序但不知道arraylist
Home Activity.java
@override
public class HomeActivity extends Activity
{
public void oncreate {
new FlightListBack.execute();
}
public class FlightListBack extends AsyncTask<String,ArrayList< HashMap<String,String>>, ArrayList<HashMap<String,String>>>
{
@Override
protected ArrayList<HashMap<String,String>> 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<sjairport.length();a++)
{
HashMap<String, String> spinnermap = new HashMap<String, String>();
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<HashMap<String, String>> result )
{
other code for display listview
}
}