안녕하세요 모두들 찾아 주셔서 감사합니다. 답변을 찾으십시오 ... 최고 점수 화면을 업데이트하려고합니다. 이다른 활동의 변수를 업데이트하십시오.
내가 그것을 새로운 점수 후 낮은 경우hScoreGen1
의 값을 변경하려면
HashMap<String,String> temp = new HashMap<String,String>();
temp.put("catGeneral","Level 1");
temp.put("score1", String.valueOf(hScoreGen1) + "/10");
listGeneral.add(temp);
... 지금까지 내가 다른이가이 내 목록을 채우고
SimpleAdapter adapter1 = new SimpleAdapter(
this,
listGeneral,
R.layout.list_highscore_row,
new String[] {"catGeneral","score1"},
new int[] {R.id.text1,R.id.text2}
);
내 어댑터입니다 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 값을 보여주는 ... 당신이 을 도울 수
필요하다면 내가 더 많은 코드를 추가 할 수 있기를 바랍니다? notifyDataSetChanged(). 자세한 정보는 [Here] (http://developer.android.com/reference/android/widget/BaseAdapter.html#notifyDataSetChanged())에서도 Main UI 스레드에서 호출해야합니다. – Skynet
'notifyDataSetChanged()'를 호출하십시오. –
notifydatachanged()를 사용하여 HashMap 및 SimpleAdapter를 업데이트하십시오. –