
Unique Top-selling Associate-Android-Developer Exams - New 2021 Google Pratice Exam
Google Developers Dumps Associate-Android-Developer Exam for Full Questions - Exam Study Guide
NEW QUESTION 71
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:
- A. val isNotificationOn = PreferenceManager.getSharedPreferences (context).getBoolean( context!!.getString(R.string.pref_notification_default_value), context!!.getString(R.string.pref_notification_key), )
- B. val isNotificationOn = PreferenceManager.getSharedPreferences (context).getBoolean( context!!.resources.getBoolean(R.bool.pref_notification_default_value), context!!.getString(R.string.pref_notification_key) )
- C. val isNotificationOn = PreferenceManager.getDefaultSharedPreferences (context).getBoolean( context!!.getString(R.string.pref_notification_key), context!!.resources.getBoolean(R.bool.pref_notification_default_value) )
Answer: C
NEW QUESTION 72
Android uses adapters (from the Adapter class) to connect data with View items in a list. There are many different kinds of adapters available, and you can also write custom adapters. To connect data with View items, the adapter needs to know about the View items. From what is extended the entity that is usually used in an adapter and describes a View item and its position within the RecyclerView?
- A. RecyclerViewAccessibilityDelegate
- B. RecyclerView.ItemDecoration
- C. RecyclerView.AdapterDataObserver
- D. RecyclerView.ViewHolder
Answer: D
Explanation:
Reference:
https://developer.android.com/guide/topics/ui/layout/recyclerview
NEW QUESTION 73
Working with Custom View. Once you define the custom attributes, you can use them in layout XML files just like built-in attributes. The only difference is that your custom attributes belong to a different namespace. Instead of belonging to the http://schemas.android.com/apk/res/android namespace, they belong to:
- A. http://schemas.android.com/apk/[your package name]
- B. http://schemas.android.com/[your package name]
- C. http://schemas.android.com/apk/res/[your package name]
Answer: C
Explanation:
Reference:
https://developer.android.com/guide/topics/ui/custom-components
NEW QUESTION 74
What do you want from Room when you create a DAO method and annotate it with @Update?
Example:
@Dao
public interface MyDao {
@Update
public void updateUsers(User... users);
}
- A. Room modifies a set of entities, given as parameters, in the database. It uses a query that matches against the primary key of each entity.
- B. Room removes a set of entities, given as parameters, from the database. It uses the primary keys to find the entities to delete.
- C. Room generates an implementation that inserts all parameters into the database in a single transaction.
Answer: A
NEW QUESTION 75
What is the placeholder tag <xliff:g> used for?
- A. To raise a quantity of translations for the string
- B. To mark text that should not be translated.
- C. To pick up and move sting translation from a different resource file
- D. To raise a translation priority to a higher level
Answer: B
Explanation:
Reference:
https://developer.android.com/guide/topics/resources/localization
NEW QUESTION 76
By adding a RoomDatabase.Callback to the room database builder RoomDatabase.Builder (method addCallback(RoomDatabase.Callback callback)), we can: (Choose two.)
- A. set the database factory
- B. handle database opening
- C. disable the main thread query check for Room
- D. handle database first time creation
Answer: B,D
NEW QUESTION 77
As an example. Our MutableLiveData<Long> object, named mLapseTime, is not connected to a Room database, etc. How can we change the value in mLapseTime?
- A. mLapseTime.changeValue(1000l)
- B. mLapseTime.postValue("new String")
- C. mLapseTime.setValue(1000l)
Answer: C
NEW QUESTION 78
Building your app from the command line, if you have a "demo" product flavor, then you can build the debug version with the command:
- A. gradlew assembleDemoDebug
- B. both variants are correct.
- C. gradlew installDemoDebug
Answer: B
Explanation:
Before immediately install build on a running emulator or connected device, installDemoDebug cause an APK building.
Reference:
https://developer.android.com/studio/run
NEW QUESTION 79
To handle an options menu item click in an activity, we usually should override method named:
- A. onClick
- B. onKey
- C. onOptionsItemSelected
Answer: C
Explanation:
Reference:
https://developer.android.com/guide/topics/ui/menus
NEW QUESTION 80
The easiest way of adding menu items (to specify the options menu for an activity) is inflating an XML file into the Menu via MenuInflater. With menu_main.xml we can do it in this way:
- A. override fun onCreateOptionsMenu(menu: Menu): Boolean { menuInflater.inflate(R.menu.menu_main, menu) return true
} - B. override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.menu.menu_main)
} - C. override fun onOptionsItemSelected(item: MenuItem): Boolean {
menuInflater.inflate(R.menu.menu_main, menu) return super.onOptionsItemSelected(item)
}
Answer: A
Explanation:
Reference:
https://developer.android.com/guide/topics/ui/accessibility/custom-views
NEW QUESTION 81
The Log class allows you to create log messages that appear in logcat. Generally, you could use the following log methods: (Choose five.)
- A. Log.d(String, String) (debug)
- B. Log.a(String, String) (all outputs)
- C. Log.w(String, String) (warning)
- D. Log.e(String, String) (error)
- E. Log.q(String, String) (questions)
- F. Log.i(String, String) (information)
- G. Log.v(String, String) (verbose)
Answer: A,C,D,F,G
NEW QUESTION 82
What is demonstrated by the code below?
// RawDao.java
@Dao
interface RawDao {
@RawQuery
User getUserViaQuery(SupportSQLiteQuery query);
}
// Usage of RawDao
...
SimpleSQLiteQuery query =
new SimpleSQLiteQuery("SELECT * FROM User WHERE id = ? LIMIT 1",
new Object[]{userId});
User user = rawDao.getUserViaQuery(query);
...
- A. A method in a RoomDatabase class as a query method.
- B. A method in a Dao annotated class as a query method.
- C. A method in a Dao annotated class as a raw query method where you can pass the query as a SupportSQLiteQuery.
Answer: C
NEW QUESTION 83
Custom views and directional controller clicks. On most devices, clicking a view using a directional controller sends (to the view currently in focus) a KeyEvent with:
- A. KEYCODE_BUTTON_SELECT
- B. KEYCODE_DPAD_CENTER
- C. KEYCODE_BUTTON_START
- D. KEYCODE_CALL
Answer: B
Explanation:
Reference:
https://developer.android.com/guide/topics/ui/accessibility/custom-views
NEW QUESTION 84
Custom duration in milliseconds as a parameter for the setDuration method is available when you are working with:
- A. for none of them
- B. for both of them
- C. Snackbar
- D. Toast
Answer: C
NEW QUESTION 85
If you want to access a specific UI component in an app, use the UiSelector class. This class represents a query for specific elements in the currently displayed UI. What is correct about it? (Choose two.)
- A. If no matching UI element is found, a UiAutomatorObjectNotFoundException is thrown.
- B. If more than one matching element is found, the first matching element in the layout hierarchy is returned as the target UiObject.
- C. If more than one matching element is found, the last matching element in the layout hierarchy is returned as the target UiObject.
- D. If no matching UI element is found, an IOException is thrown.
Answer: A,B
NEW QUESTION 86
With a room database. When performing queries, you'll often want your app's UI to update automatically when the data changes. Can you use a return value of type LiveData in your query method description to achieve this?
- A. No
- B. Yes
Answer: B
Explanation:
Room generates all necessary code to update the LiveData when the database is updated.
NEW QUESTION 87
Relative positioning is one of the basic building blocks of creating layouts in ConstraintLayout. Constraints allow you to position a given widget relative to another one. What constraints do not exist?
- A. layout_constraintStart_toEndOf
- B. layout_constraintBaseline_toBaselineOf
- C. layout_constraintBaseline_toStartOf
- D. layout_constraintBottom_toBottomOf
Answer: C
Explanation:
Reference:
https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintLayout
NEW QUESTION 88
About running a debuggable build variant. Usually, you can just select the default "debug" variant that's included in every Android Studio project (even though it's not visible in the build.gradle file). But if you define new build types that should be debuggable, you must add 'debuggable true' to the build type. Is that mostly true?
- A. No, if you define new build types that should be debuggable, you must add 'debuggable false'
- B. Yes.
- C. No, the debug variant should be visible in the build.gradle file anyway.
Answer: B
NEW QUESTION 89
Android Tests. You can use the childSelector() method to nest multiple UiSelector instances. For example, the following code example shows how your test might specify a search to find the first ListView in the currently displayed UI, then search within that ListView to find a UI element with the text property Apps.
What is the correct sample?
- A. UiObject appItem = device.findObject(new UiSelector()
.className("android.widget.ListView")
.instance(0)
.childSelector(new UiSelector()
.text("Apps"))); - B. UiObject appItem = device.findObject(new UiSelector()
.className("android.widget.ListView")
.instance(new UiSelector()
.text("Apps"))); - C. UiObject appItem = device.findObject(new UiSelector()
.className(ListView.class)
.instance(1)
.childSelector(new UiSelector()
.text("Apps")));
Answer: A
NEW QUESTION 90
Working with Custom View. To define custom attributes, we can add <declare-styleable> resources to our project. It is customary to put these resources into a file:
- A. res/raw/attrs.xml
- B. res/layout/attrs.xml
- C. res/xml/attrs.xml
- D. res/values/attrs.xml
Answer: D
Explanation:
Reference:
https://developer.android.com/guide/topics/ui/custom-components
NEW QUESTION 91
If constant LENGTH_INDEFINITE is used as a parameter for the setDuration method in Snackbar, what will happen?
- A. The Snackbar will be displayed for a short period of time.
- B. The Snackbar will be displayed from the time that is shown until either it is dismissed, or another Snackbar is shown.
- C. The Snackbar will be displayed for a very long period of time.
- D. The Snackbar will be displayed for a long period of time.
- E. The constant LENGTH_INDEFINITE is impossible parameter for the setDuration method in Snackbar
Answer: B
NEW QUESTION 92
Room can export your database's schema information into a JSON file at compile time. What annotation processor property you should set in your app/build.gradle file to export the schema?
- A. room.schemaLocation
- B. room.expandProjection
- C. room.incremental
Answer: A
Explanation:
android {
...
defaultConfig {
...
javaCompileOptions {
annotationProcessorOptions {
arguments += ["room.schemaLocation":
"$projectDir/schemas".toString()]
}
}
}
}
NEW QUESTION 93
......
Best way to practice test for Google Associate-Android-Developer: https://www.dumpsquestion.com/Associate-Android-Developer-exam-dumps-collection.html