Google ASSOCIATE-ANDROID-DEVELOPER Exam (page: 3)
Google Associate Android Developer
Updated on: 12-Feb-2026

For example, our preferences.xml file was added by addPreferencesFromResource (R.xml.preferences). Our preferences.xml file contains such item:
<SwitchPreference
android:id="@+id/notification"
android:key="@string/pref_notification_key"
android:title="@string/pref_notification_title"
android:summary="@string/pref_notification_summary"
android:defaultValue="@bool/pref_notification_default_value"
app:iconSpaceReserved="false"/>

In our Fragment, we can dynamically get current notification preference value in this way:

  1. val isNotificationOn = PreferenceManager.getDefaultSharedPreferences(context).getBoolean(
    context!!.getString(R.string.pref_notification_key),
    context!!.resources.getBoolean(R.bool.pref_notification_default_value)
    )
  2. val isNotificationOn = PreferenceManager.getSharedPreferences(context).getBoolean(
    context!!.getString(R.string.pref_notification_default_value),
    context!!.getString(R.string.pref_notification_key),
    )
  3. val isNotificationOn = PreferenceManager.getSharedPreferences(context).getBoolean(
    context!!.resources.getBoolean(R.bool.pref_notification_default_value),
    context!!.getString(R.string.pref_notification_key)
    )

Answer(s): A



For example, our preferences.xml file was added by addPreferencesFromResource (R.xml.preferences). Our preferences.xml file contains such item:

<ListPreference
android:id="@+id/order_by"
android:key="@string/pref_sort_key"
android:title="@string/pref_sort_title"
android:summary="@string/pref_sort_summary"
android:dialogTitle="@string/pref_sort_dialog_title"
android:entries="@array/sort_oder"
android:entryValues="@array/sort_oder_value"
android:defaultValue="@string/pref_default_sort_value"
app:iconSpaceReserved="false" />

In our Fragment, we can dynamically get current notification preference value in this way:

  1. val sortBy = PreferenceManager.getDefaultSharedPreferences(context).getString(
    context!!.getString(R.string.pref_sort_key),
    context!!.resources.getBoolean(R.bool.pref_default_sort_value)
    )
  2. val sortBy = PreferenceManager.getSharedPreferences(context).getString(
    context!!.getString(R.string.pref_default_sort_value),
    context!!.getString(R.string.pref_sort_key),
    )
  3. val sortBy = PreferenceManager.getSharedPreferences(context).getBoolean(
    context!!.resources.getBoolean(R.bool.pref_default_sort_value),
    context!!.getString(R.string.pref_sort_key)
    )
  4. val sortBy = PreferenceManager.getDefaultSharedPreferences(context).getString(
    context!!.getString(R.string.pref_sort_key),
    context!!.getString(R.string.pref_default_sort_value)
    )

Answer(s): D



For example, we have a file in our raw folder app/src/main/res/raw/sample_teas.json. To get an
InputStream for reading it, from out Context context, we can do this:

  1. val input = context!!.openRawResource(R.raw.sample_teas)
  2. val input = context!!.getRawResource(R.raw.sample_teas)
  3. val input = context!!.resources.openRawResource(R.raw.sample_teas)

Answer(s): C



For example, we have a BufferedReader reader, associated with the json file through
InputStreamReader. To get a file data we can do this:

  1. var line: String?
    try {
    while (reader.readLine().also { line = it } != null) {
    builder.append(line)
    }
    val json = JSONObject(builder.toString())
    return json
    } catch (exception: IOException) {
    exception.printStackTrace()
    } catch (exception: JSONException) {
    exception.printStackTrace()
    }
  2. var line: JSONObject ?
    try {
    while (reader.readJSONObject ().also { line = it } != null) {
    builder.append(line)
    }
    val json = JSONObject(builder.toString())
    return json
    } catch (exception: IOException) {
    exception.printStackTrace()
    } catch (exception: JSONException) {
    exception.printStackTrace()
    }
  3. var line: String?
    try {
    while (reader.readLine().also { line = it } != null) {
    builder.append(line)
    }
    val json = JSONObject(builder.toString())
    return json
    } catch (exception: RuntimeException) {
    exception.printStackTrace()
    } catch (exception: ArrayIndexOutOfBoundsException) {
    exception.printStackTrace()
    }

Answer(s): A



For example, we have a file in our assets folder app/src/main/assets/sample_teas.json. To get an InputStream for reading it, from out Context context, we can try do this:

  1. val input = context!!.resources.openRawResource(R.raw.sample_teas)
  2. val input = context!!.assets.open("sample_teas.json")
  3. val input = context!!.resources.assets.open("sample_teas.json")

Answer(s): B



Viewing Page 3 of 27



Share your comments for Google ASSOCIATE-ANDROID-DEVELOPER exam with other users:

yenvti2@gmail.com 8/12/2023 7:56:00 PM

very helpful for exam preparation
Anonymous


Miguel 10/5/2023 12:16:00 PM

question 11: https://help.salesforce.com/s/articleview?id=sf.admin_lead_to_patient_setup_overview.htm&type=5
SPAIN


Noushin 11/28/2023 4:52:00 PM

i think the answer to question 42 is b not c
CANADA


susan sandivore 8/28/2023 1:00:00 AM

thanks for the dump
Anonymous


Aderonke 10/31/2023 12:51:00 AM

fantastic assessments
Anonymous


Priscila 7/22/2022 9:59:00 AM

i find the xengine test engine simulator to be more fun than reading from pdf.
GERMANY


suresh 12/16/2023 10:54:00 PM

nice document
Anonymous


Wali 6/4/2023 10:07:00 PM

thank you for making the questions and answers intractive and selectable.
UNITED STATES


Nawaz 7/18/2023 1:10:00 AM

answers are correct?
UNITED STATES


das 6/23/2023 7:57:00 AM

can i belive this dump
INDIA


Sanjay 10/15/2023 1:34:00 PM

great site to practice for sitecore exam
INDIA


jaya 12/17/2023 8:36:00 AM

good for students
UNITED STATES


Bsmaind 8/20/2023 9:23:00 AM

nice practice dumps
Anonymous


kumar 11/15/2023 11:24:00 AM

nokia 4a0-114 dumps
Anonymous


Vetri 10/3/2023 12:59:00 AM

great content and wonderful to have the answers with explanation
UNITED STATES


Ranjith 8/21/2023 3:39:00 PM

for question #118, the answer is option c. the screen shot is showing the drop down, but the answer is marked incorrectly please update . thanks for sharing such nice questions.
Anonymous


Eduardo Ramírez 12/11/2023 9:55:00 PM

the correct answer for the question 29 is d.
Anonymous


Dass 11/2/2023 7:43:00 AM

question no 22: correct answers: bc, 1 per session 1 per page 1 per component always
UNITED STATES


Reddy 12/14/2023 2:42:00 AM

these are pretty useful
Anonymous


Daisy Delgado 1/9/2023 1:05:00 PM

awesome
UNITED STATES


Atif 6/13/2023 4:09:00 AM

yes please upload
UNITED STATES


Xunil 6/12/2023 3:04:00 PM

great job whoever put this together, for the greater good! thanks!
Anonymous


Lakshmi 10/2/2023 5:26:00 AM

just started to view all questions for the exam
NETHERLANDS


rani 1/19/2024 11:52:00 AM

helpful material
Anonymous


Greg 11/16/2023 6:59:00 AM

hope for the best
UNITED STATES


hi 10/5/2023 4:00:00 AM

will post exam has finished
UNITED STATES


Vmotu 8/24/2023 11:14:00 AM

really correct and good analyze!
AZERBAIJAN


hicham 5/30/2023 8:57:00 AM

excellent thanks a lot
FRANCE


Suman C 7/7/2023 8:13:00 AM

will post once pass the cka exam
INDIA


Ram 11/3/2023 5:10:00 AM

good content
Anonymous


Nagendra Pedipina 7/13/2023 2:12:00 AM

q:32 answer has to be option c
INDIA


Tamer Barakat 12/7/2023 5:17:00 PM

nice questions
Anonymous


Daryl 8/1/2022 11:33:00 PM

i really like the support team in this website. they are fast in communication and very helpful.
UNITED KINGDOM


Curtis Nakawaki 6/29/2023 9:13:00 PM

a good contemporary exam review
UNITED STATES