gpt4 book ai didi

android - getInt() SharedPreferences 安卓错误

转载 作者:行者123 更新时间:2023-11-29 14:22:03 26 4
gpt4 key购买 nike

<分区>

SharedPreferences peepsScores= PreferenceManager.getDefaultSharedPreferences(GamePlayFirst.this);
SharedPreferences.Editor editor =peepsScores.edit();

editor.putInt("userScore1", zero);
editor.putInt("userScore2", zero);
editor.putInt("userScore3", zero);
editor.putInt("userScore4", zero);
editor.putInt("userScore5", zero);
editor.putInt("userScore6", zero);
editor.putInt("userScore7", zero);
editor.putInt("userScore8", zero);
editor.commit();

SharedPreferences peepsScores = PreferenceManager.getDefaultSharedPreferences(this);
//tryed this
int userScore1 = peepsScores.getInt("userScore1","u");
//tryed this
userScore2 = peepsScores.getInt("userScore2","0");
//and tryed this
String userScore3 = peepsScores.getInt("userScore3","0");
String userScore4 = peepsScores.getInt("userScore4","0");
String userScore5 = peepsScores.getInt("userScore5","0");
String userScore6 = peepsScores.getInt("userScore6","0");
String userScore7 = peepsScores.getInt("userScore7","0");
String userScore8 = peepsScores.getInt("userScore8","0");

无论我改变什么随机的东西,getint 方法都带有下划线,然后如果我删除接收类的第一行,peepScore 带有下划线我一直在 android dev webiste 这个网站和谷歌上,一切都说它和 getInt 一样简单什么我做错了吗

我会想办法稍后再添加,我想当我最终得到这个时我会发布这个给所有像我这样的新手看哈哈

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com