@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); database = new Database(this); database.open(); setContentView(R.layout.time_rush_game_score_layout); players = getDBRecords(); database.close(); TextView noScore = (TextView) findViewById(R.id.no_score_text_view); ListView list = (ListView) findViewById(R.id.local_high_score_list); if (players.size() == 0) { noScore.setVisibility(View.VISIBLE); } else { noScore.setVisibility(View.INVISIBLE); } Collections.sort(players, scoreComparator); TimeRushGameScoreArrayAdapter highScoreArrayAdapter = new TimeRushGameScoreArrayAdapter(this, R.layout.time_rush_game_score_element, players); list.setAdapter(highScoreArrayAdapter); }
public List<PlayerScore> getDBRecords() { Cursor c = database.getTimeRushGameScores(); return DatabaseCommon.getTimeRushGamePlayerScoreList(c); }