Free Associate Android Developer Exam Braindumps (page: 14)

Page 13 of 33

In a class PreferenceFragmentCompat. What method is called during onCreate(Bundle) to supply the preferences for this fragment. And where subclasses are expected to call setPreferenceScreen (PreferenceScreen) either directly or via helper methods such as addPreferencesFromResource (int)?

  1. onCreateLayoutManager
  2. onCreatePreferences
  3. onCreateRecyclerView
  4. onCreateView

Answer(s): B



In a class PreferenceFragmentCompat. As a convenience, this fragment implements a click listener for any preference in the current hierarchy. So, in what overridden method we can handle that a preference in the tree rooted at this PreferenceScreen has been clicked?

  1. onCreateLayoutManager
  2. onCreatePreferences
  3. onCreateRecyclerView
  4. onPreferenceTreeClick

Answer(s): D



SharedPreferences.Editor is an interface used for modifying values in a SharedPreferences object. All changes you make in an editor are batched, and not copied back to the original SharedPreferences until you call:

  1. commit()
  2. apply()
  3. commit() or apply()

Answer(s): C



SharedPreferences.Editor is an interface used for modifying values in a SharedPreferences object. To mark in the editor that a preference value should be removed, which will be done in the actual preferences once commit() or apply() is called, what method in SharedPreferences.Editor should we use?

  1. delete(String key)
  2. clear()
  3. remove(String key)
  4. removeAll()

Answer(s): B

Explanation:

clear() method marks in the editor to remove ALL values from the preferences. Once commit is called, the only remaining preferences will be any that you have defined in this editor.
And no delete and removeAll method exists in SharedPreferences.Editor






Post your Comments and Discuss Google Associate Android Developer exam with other Community members:

Associate Android Developer Discussions & Posts