我在 ArrayList 中保存了数据,并把它们降序排列。现在我想把数据在 ListView 中显示出来。
如何把数据显示出来?
spndata.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long arg3) { switch (position) { case 0: list = DBAdpter.requestUserData(assosiatetoken); for (int i = 0; i < list.size(); i++) { if (list.get(i).lastModifiedDate != null) { lv.setAdapter(new MyListAdapter( getApplicationContext(), list)); } } break; case 1: list = DBAdpter.requestUserData(assosiatetoken); Calendar c = Calendar.getInstance(); SimpleDateFormat df3 = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss a"); String formattedDate3 = df3.format(c.getTime()); Log.v("log_tag", "Date " + formattedDate3); for (int i = 0; i < list.size(); i++) { if (list.get(i).submitDate != null) { String sDate = list.get(i).submitDate; SimpleDateFormat df4 = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss a"); String formattedDate4 = df4.format(sDate); Map<Date, Integer> dateMap = new TreeMap<Date, Integer>(new Comparator<Date>(){ public int compare(Date formattedDate3, Date formattedDate4) { return formattedDate3.compareTo(formattedDate4); } });
慕无忌1623718
阿晨1998
相关分类