private List setDataToList() { List list = new ArrayList<String>(); List dateList = dataDB.loadMyScore(); String nowTime = ""; for (int i = 0; i < dateList.size(); i++) { MyScore myScore = (MyScore) dateList.get(i); // Log.i("Fragment_Score_StudyMoney", myScore.getName()); if (nowTime.equals(myScore.getTime())) { list.add(myScore.getName()); score.add(myScore.getScore()); studyScore.add(myScore.getStudyScore()); // nowData.add(myScore); } else { allCheckData.add(i + allCheckData.size()); Log.i("Fragment_Score_StudyMoney", allCheckData.toString()); list.add(myScore.getTime()); nowTime = myScore.getTime(); score.add(""); studyScore.add(""); i = i - 1; // nowData.add(myScore); } } // Log.i("Fragment_Score_StudyMoney", list.toString()); return list; }
private void init() { allCheckData = new ArrayList<Integer>(); // algorithm = (EditText) view.findViewById(R.id.studyMoneyEditText); finallyScore = (TextView) view.findViewById(R.id.studyMoneyTextView); listView = (ListView) view.findViewById(R.id.fragment_score_studentscore_listview); dataDB = DataDB.getInstance(getActivity()); myAdapter = new MyAdapter( getActivity(), R.layout.list_item_studyscore, new int[] {R.id.list_textView1, R.id.list_checkbox}, setDataToList()); listView.setAdapter(myAdapter); listView.setOnItemClickListener(new ListListener()); }