i want top score ,i used static variable to store it but when i closed application and reopen entire application values top score starts from 0 .but i want my past top score .please help me....


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | public static void updateScore( int score) { if (UserInfo.isStorageAvailable()) { System.err.printLn(„No storage available“); return ; } UserInfo user = UserInfo.getMyInfo(); if (user.getScore() >= score) return ; // No new highscore, so don’t update it user.setScore(score); user.store(); } public void getHigh() { UserInfo user = UserInfo.getMyInfo(); return user != null ? user.getScore() : 0 ; } |