英文:
(Android) What are these variable?
问题
//检索数值
Set<String> set = myScores.getStringSet("key", null);
//设置数值
Set<String> set = new HashSet<String>();
set.addAll(listOfExistingScores);
scoreEditor.putStringSet("key", set);
scoreEditor.commit();
myScores
是指 SharedPreferences 吗?listOfExistingScores
是指什么?是 ArrayList 吗?scoreEditor
是指 ArrayList 吗?还是 ListView?抑或是自定义 ListView?
英文:
source: this post
//Retrieve the values
Set<String> set = myScores.getStringSet("key", null);
//Set the values
Set<String> set = new HashSet<String>();
set.addAll(listOfExistingScores);
scoreEditor.putStringSet("key", set);
scoreEditor.commit();
-
is
myScores
refers to sharedpreference? -
what is
listOfExistingScores
refers to? is it ArrayList? -
is
scoreEditor
refers to ArrayList? or ListView? or custom ListView?
答案1
得分: 0
根据那个答案,你可以说这三个变量定义了以下内容:
myScores:
正如你在原帖中所说,这是一个共享偏好变量。它持有 sharedpreference
。
listOfExistingScores:
它指的是用户声明的数组。它存储在哈希集中。
scoreEditor:
分数编辑器是 sharedpreferences 编辑器。你可以通过给定的链接阅读更多详细信息。
英文:
According to that answser you can say that those three variable defines following things :
myScores :
As you said in op, it's shared preference variable. It holdes sharedpreference
.
listOfExistingScores :
It refers to the array declared by user. It is stored in hashset.
scoreEditor :
Score editor is sharedpreferences editor. You can read more details about it by given link.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论