3 Months Free Update
3 Months Free Update
3 Months Free Update
Which build options in the Build menu to choose to delete all intermediate/cached build files.
A content label sometimes depends on information only available at runtime, or the meaning of a View might change over time. For example, a Play button might change to a Pause button during music playback. In these cases, to update the content label at the appropriate time, we can use:
Custom views and directional controller clicks. In general, you should send an AccessibilityEvent whenever the content of your custom view changes. For example, if a text value was changed in your custom view, you should emit an event of this type:
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 doing this:
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:
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:
“Set the activity content to an explicit view. This view is placed directly into the activity's view hierarchy. It can itself be a complex view hierarchy.” This can be done by calling method:
When scheduling unique work, you must tell WorkManager what action to take when there is a conflict. You do this by passing an enum when enquing the work. For one-time work, you provide an ExistingWorkPolicy, which supports some options for handling the conflict. (Choose four.)
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.)
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.)
What happens when you create a DAO method and annotate it with @Insert?
Example:
@Dao
interface MyDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
fun insertUsers(vararg users: User)
}
With our Context we can get SharedPreferences with a method, named: getSharedPreferences (String name, int mode). What value can we transfer in a “mode”parameter?
As an example. Our MutableLiveData
Filter logcat messages. If in the filter menu, a filter option “Edit Filter Configuration”? means:
The Testing Pyramid, shown in the Figure, illustrates how your app should include the three categories of tests: small, medium, and large. Small tests are unit tests that :
With recommended app architecture. Fill the following diagram, which shows how all the modules usually should interact with one another after designing the app (drag modules to correct places).
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?
A class that you create for managing multiple data sources. In addition to a Room database, this class could manage remote data sources such as a web server. It is about:
By executing an allowMainThreadQueries() method to the room database builder
RoomDatabase.Builder, we can:
Interface for a callback to be invoked when a shared preference is changed. Interface is named:
In our TeaViewModel class, that extends ViewModel, we have such prorerty:
val tea: LiveData
An observer in our Activity (type of mViewModel variable in example is TeaViewModel) is set in this way:
mViewModel!!.tea.observe(this, Observer { tea: Tea? -> displayTea(tea) })
What will be a correct displayTea method definition?
For example, our preferences.xml file was added by addPreferencesFromResource (R.xml.preferences). Our preferences.xml file contains such item:
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:
Each time your test invokes onView(), Espresso waits to perform the corresponding UI action or assertion until the following synchronization conditions are met: (Choose three.)
By default, the notification's text content is truncated to fit one line. If you want your notification to be longer, for example, to create a larger text area, you can do it in this way:
In general, you should send an AccessibilityEvent whenever the content of your custom view changes. For example, if you are implementing a custom slider bar that allows a user to select a numeric value by pressing the left or right arrows, your custom view should emit an event of type TYPE_VIEW_TEXT_CHANGED whenever the slider value changes. Which one of the following sample codes demonstrates the use of the sendAccessibilityEvent() method to report this event.
For example, we have a BufferedReader reader, associated with the json file through
InputStreamReader. To get a file data we can do this:
Working with Custom View. To define custom attributes, we can add
Move the major components of the Android platform to correct places in diagram.
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:
If constant LENGTH_INDEFINITE is used as a parameter for the setDuration method in Snackbar, what will happen?
In general, you should send an AccessibilityEvent whenever the content of your custom view changes. For example, if you are implementing a custom slider bar that allows a user to select a numeric value by pressing the left or right arrows, your custom view should emit an event of type TYPE_VIEW_TEXT_CHANGED whenever the slider value changes. Which one of the following sample codes demonstrates the use of the sendAccessibilityEvent() method to report this event.
What public methods are there in android.widget.Toast.Callback? (Choose two.)