@Override protected void onPostExecute(String s) { if (s != null) { Log.d(sTAG, s); BusLineBriefList.get(getActivity()).add(BusLineBrief.parse(s)); if (BusLineBriefList.get(getActivity()).getBusLines().isEmpty()) { showToastInfo(R.string.bus_line_not_exist); } mAdapter.notifyDataSetChanged(); } else { showToastInfo(R.string.query_failed); } mQueryBusLine.setEnabled(true); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mBusLineBriefs = BusLineBriefList.get(getActivity()).getBusLines(); mAdapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_list_item_1, mBusLineBriefs); }