(Android)这些变量是什么?

huangapple go评论86阅读模式
英文:

(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&lt;String&gt; set = myScores.getStringSet(&quot;key&quot;, null);

//Set the values
Set&lt;String&gt; set = new HashSet&lt;String&gt;();
set.addAll(listOfExistingScores);
scoreEditor.putStringSet(&quot;key&quot;, 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.

huangapple
  • 本文由 发表于 2020年10月17日 12:59:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/64399163.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定