Search code examples
javaandroidarraysandroid-studiosharedpreferences

(Android) What are these variable?


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?

Solution

  • 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.