
Associate-Android-Developer Training & Certification Get Latest Google Developers Updated on Aug 08, 2021
Certification Training for Associate-Android-Developer Exam Dumps Test Engine
NEW QUESTION 63
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 64
Enable debugging on your device: If you are using the emulator, this is enabled by default. But for a connected device, you need to
- A. enable transfer data from the device in usb connection options.
- B. enable connection in bluetooth options.
- C. enable debugging in the device developer options.
Answer: C
NEW QUESTION 65
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:
- A. val input = context!!.getRawResource(R.raw.sample_teas)
- B. val input = context!!.openRawResource(R.raw.sample_teas)
- C. val input = context!!.resources.openRawResource(R.raw.sample_teas)
Answer: C
NEW QUESTION 66
LiveData.postValue() and LiveData.setValue() methods have some differences. So if you have a following code executed in the main thread:
liveData.postValue("a"); liveData.setValue("b");
What will be the correct statement?
- A. The value "a" would be set at first and later the main thread would override it with the value "b".
- B. The value "b" would be set at first and would not be overridden with the value "a".
- C. The value "a" would be set at first and would not be overridden with the value "b".
- D. The value "b" would be set at first and later the main thread would override it with the value "a".
Answer: A
NEW QUESTION 67
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 68
RecyclerView is a subclass of ViewGroup and is a more resource-efficient way to display scrollable lists. Instead of creating a View for each item that may or may not be visible on the screen, RecyclerView:
- A. creates a limited number of list items and reuses them for visible content.
- B. creates a single list item and reuses it for visible content.
- C. creates an unlimited number of list items and never reuses them
- D. creates a single list item and never reuses it
Answer: A
Explanation:
Reference:
https://developer.android.com/guide/topics/ui/layout/recyclerview
NEW QUESTION 69
For example, suppose that in a XML file (res/menu/menu_main.xml as an example), where menu items are described, we have such item:
...
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/menu_action_settings"
app:showAsAction="never" />
...
Attribute "app:showAsAction" shows when and how this item should appear as an action item in the app bar. What value "never" in this attribute means?
- A. Never place this item in the app bar. Instead, list the item in the app bar's overflow menu.
- B. Always place this item in the app bar. Avoid using this unless it's critical that the item always appear in the action bar. Setting multiple items to always appear as action items can result in them overlapping with other UI in the app bar.
- C. The action view associated with this action item (as declared by android:actionLayout or android:actionViewClass) is collapsible.
- D. Also include the title text (defined by android:title) with the action item. You can include this value along with one of the others as a flag set, by separating them with a pipe.
- E. Only place this item in the app bar if there is room for it. If there is not room for all the items marked by this value, the items with the lowest orderInCategory values are displayed as actions, and the remaining items are displayed in the overflow menu.
Answer: A
Explanation:
Reference:
https://developer.android.com/guide/topics/ui/menus
NEW QUESTION 70
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 71
We have a custom view that extends android.widget.ProgressBar. Our progress bar is not touchable, focusable, etc.: it just shows progress. Style for our custom progress bar extends
"Widget.AppCompat.ProgressBar.Horizontal". An item, named "progressDrawable", in our style, is a xml file . What we usually can see as a main single element in this xml file:
- A. A State List (<selector> element )
- B. A Layer List (<layer-list> element) with items android:id="@+id/progress" and android:id="@+id/ background" inside it.
- C. An <ImageView> element with android:id="@+id/progress" identifier
Answer: B
Explanation:
Reference:
https://developer.android.com/guide/topics/resources/drawable-resource
NEW QUESTION 72
What statements about InputStreamReader (java.io.InputStreamReader) are correct? (Choose two.)
- A. An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes them into characters using a specified charset. The charset that it uses may be specified by name or may be given explicitly, or the platform's default charset may be accepted.
- B. No any invocation of one of an InputStreamReader's read() methods can cause some bytes to be read from the underlying byte-input stream.
- C. Each invocation of one of an InputStreamReader's read() methods may cause one or more bytes to be read from the underlying byte-input stream. To enable the efficient conversion of bytes to characters, more bytes may be read ahead from the underlying stream than are necessary to satisfy the current read operation.
- D. An InputStreamReader is a bridge from character streams to byte streams: It reads characters using a specified charset and encodes them into bytes. The charset that it uses may be specified by name or may be given explicitly, or the platform's default charset may be accepted.
Answer: A,C
NEW QUESTION 73
About queries in DAO classes. Room verifies the return value of the query such that if the name of the field in the returned object doesn't match the corresponding column names in the query response, Room alerts you in one of the following two ways: (Choose two.)
- A. It gives a warning if no field names match.
- B. It gives an error if no field names match.
- C. It gives a warning if only some field names match.
- D. It gives an error if only some field names match.
Answer: B,C
NEW QUESTION 74
Select four different types of app components. (Choose four.)
- A. WorkManager
- B. Activities
- C. Application
- D. Content providers
- E. Services
- F. Fragments
- G. Layouts
- H. Broadcast receivers
- I. AlarmManager
Answer: B,D,E,H
NEW QUESTION 75
The following code snippet shows an example of an Espresso test:
- A. @Test
public void greeterSaysHello() {
onView(withId(R.id.name_field)).do(typeText("Steve"));
onView(withId(R.id.greet_button)).do(click());
onView(withText("Hello Steve!")).compare(matches(isDisplayed()));
} - B. @Test
public void greeterSaysHello() {
onView(withId(R.id.name_field)).perform(typeText("Steve"));
onView(withId(R.id.greet_button)).perform(click());
onView(withText("Hello Steve!")).check(matches(isDisplayed()));
} - C. @Rule
public void greeterSaysHello() {
onView(withId(R.id.name_field)).do(typeText("Steve"));
onView(withId(R.id.greet_button)).do(click());
onView(withText("Hello Steve!")).check(matches(isDisplayed()));
}
Answer: B
NEW QUESTION 76
If you want the Database Inspector to automatically update the data it presents as you interact with your running app, check the Live updates checkbox at the top of the inspector window. While live updates are enabled, what happens with the table in the inspector window?
- A. It is still editable. You can modify data in a table by double-clicking a cell, typing a new value, and pressing Enter.
- B. It becomes read-only, but you cannot see its updated values before updating the data by clicking the Refresh table button at the top of the inspector window.
- C. It becomes read-only and you cannot modify its values.
Answer: C
NEW QUESTION 77
As an example. In an Activity we have our TimerViewModel object (extended ViewModel), named mTimerViewModel. mTimerViewModel.timer method returns a LiveData<Long> value. What can be a correct way to set an observer to change UI in case if data was changed?
- A. mTimerViewModel.observe
(Observer { aLong -> callAnyChangeUIMethodHere(aLong!!) }) - B. mTimerViewModel!!.timer.value.toString().observe
(Observer { aLong -> callAnyChangeUIMethodHere(aLong!!) }) - C. mTimerViewModel!!.timer.observe
(this, Observer { aLong -> callAnyChangeUIMethodHere(aLong!!) })
Answer: C
NEW QUESTION 78
In a class extended PreferenceFragmentCompat. What method is used to inflate the given XML resource and add the preference hierarchy to the current preference hierarchy?
- A. setPreferenceScreen
- B. findPreference
- C. getPreferenceManager
- D. addPreferencesFromResource
Answer: D
NEW QUESTION 79
Select 3 major components of the Room. (Choose three.)
- A. @RawQuery
- B. @WorkerThread
- C. @Database
- D. @Entity
- E. @DAO
- F. @Query
Answer: C,D,E
NEW QUESTION 80
Content labels. What attribute to use to indicate that a View should act as a content label for another View?
- A. android:contentDescription
- B. android:labelFor
- C. android:hint
Answer: B
Explanation:
Reference:
https://support.google.com/accessibility/android/answer/7158690?hl=en
NEW QUESTION 81
Assume that an app includes a default set of graphics and two other sets of graphics, each optimized for a different device setup:
res/drawable/
Contains default graphics. res/drawable-small-land-stylus/
Contains graphics optimized for use with a device that expects input from a stylus and has a QVGA low- density screen in landscape orientation. res/drawable-ja/ Contains graphics optimized for use with Japanese.
What happens if the app runs on a device that is configured to use Japanese and, at the same time, the device happens to be one that expects input from a stylus and has a QVGA low-density screen in landscape orientation?
- A. Android loads graphics from res/drawable-ja/
- B. Android loads graphics from res/drawable-small-land-stylus/
- C. Android loads graphics from res/drawable/
Answer: A
Explanation:
Reference:
https://developer.android.com/guide/topics/resources/localization
NEW QUESTION 82
......
Step by Step Guide to Prepare for Associate-Android-Developer Exam: https://www.itcertmagic.com/Google/real-Associate-Android-Developer-exam-prep-dumps.html