SimpleAdapter adapter1 = new SimpleAdapter(
this,
listGeneral,
R.layout.list_highscore_row,
new String[] {"catGeneral","score1"},
new int[] {R.id.text1,R.id.text2}
);
这填补了我的清单
HashMap<String,String> temp = new HashMap<String,String>();
temp.put("catGeneral","Level 1");
temp.put("score1", String.valueOf(hScoreGen1) + "/10");
listGeneral.add(temp);
我想更改hScoreGen1
的值,如果它低于新分数...
到目前为止,我在另一个应该改变hScoreGen1
if (totalCorrect > ScoreScreen.currentScoreCatValue){ //currentScoreCatValue is the orginal value of hScoreGen1
if (currentScoreCat == 1){ //currentScoreCat is set to 1 from another activity
HighScores.hScoreGen1 = totalCorrect;
我的问题似乎是列表视图没有显示更改的值而是显示onCreate值...希望你能帮忙 我可以根据需要添加更多代码
答案 0 :(得分:0)
更新你的适配器
if (totalCorrect > ScoreScreen.currentScoreCatValue){ //currentScoreCatValue is the orginal value of hScoreGen1
if (currentScoreCat == 1){ //currentScoreCat is set to 1 from another activity
HighScores.hScoreGen1 = totalCorrect;
HighScores.adapter1.notifydatachanged();