ASSOCIATE-ANDROID-DEVELOPER practice question 10 of 25
For example, our preferences.xml file was added by addPreferencesFromResource (R.xml.preferences). Our preferences.xml file contains such item: In our Fragment, we can dynamically get current notification preference value in this way:
Full set: 128 questionsCorrect Answer:
A. val isNotificationOn = PreferenceManager.getDefaultSharedPreferences (context).getBoolean(
context!!.getString(R.string.pref_notification_key),
context!!.resources.getBoolean(R.bool.pref_notification_default_value)
)
Keep practicing
Take the free ASSOCIATE-ANDROID-DEVELOPER practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other ASSOCIATE-ANDROID-DEVELOPER practice questions
- Question 1An overridden method onCreateOptionsMenu in an Activity returns boolean value. What does …
- Question 2Android Tests. You can use the childSelector() method to nest multiple UiSelector instanc…
- Question 3What is a correct part of an Implicit Intent for sharing data implementation?
- Question 4As an example. Our MutableLiveData object, named mLapseTime, is not connected to a Room d…
- Question 5About queries in DAO classes. Room verifies the return value of the query such that if th…
- Question 6The following code snippet shows an example of an Espresso test:
