The following code snippet shows an example of an Espresso test:
A. @Rule
fun 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()))
}
B. @Test
fun 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. @Test
fun 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()))
}
To automate UI tests with Android Studio, you implement your test code in a separate Android test folder. Folder could be named:
A. app/androidTest/java
B. app/src/androidTest/java
C. app/java/androidTest
The Layout Inspector in Android Studio allows you to compare your app layout with design mockups, display a magnified or 3D view of your app, and examine details of its layout at runtime. When this is especially useful?
A. when your layout is built entirely in XML rather than runtime and the layout is behaving expectedly.
B. when your layout is built at runtime rather than entirely in XML and the layout is behaving unexpectedly.
To run a debuggable build variant you must use a build variant that includes
A. minifyEnabled false in the build configuration
B. debuggable true or debuggable false in the build configuration
C. debuggable true in the build configuration
Interface for a callback to be invoked when a shared preference is changed. Interface is named:
A. android.content.SyncStatusObserver
B. android.content.SharedPreferences.Editor
C. android.content.SharedPreferences.OnSharedPreferenceChangeListener
D. android.content.SharedPreferences
"workManager" is an instance of WorkManager. Select correct demonstration of WorkRequest cancellation:
A. workManager.enqueue(new OneTimeWorkRequest.Builder(FooWorker.class).build());
B. WorkRequest request = new OneTimeWorkRequest.Builder(FooWorker.class).build();workManager.enqueue(request);LiveData
C. WorkRequest request = new OneTimeWorkRequest.Builder(FooWorker.class).build();workManager.enqueue(request);workManager.cancelWorkById(request.getId());
D. WorkRequest request1 = new OneTimeWorkRequest.Builder(FooWorker.class).build();WorkRequest request2 = new OneTimeWorkRequest.Builder(BarWorker.class).build();WorkRequest request3 = new OneTimeWorkRequest.Builder(BazWorker.class).build();workManager.beginWith(request1, request2).then(request3).enqueue();
E. WorkRequest request = new OneTimeWorkRequest.Builder(FooWorker.class).build();workManager.enqueue(request);workManager.cancelWork(request);
As an example. In an Activity we have our TimerViewModel object (extended ViewModel), named mTimerViewModel. mTimerViewModel.getTimer() method returns a LiveData
A. mTimerViewModel.getTimer().getValue().toString().observe(new Observer
callAnyChangeUIMethodHere(aLong)
}
});
B. mTimerViewModel.getTimer().observe(this, new Observer
callAnyChangeUIMethodHere(aLong)
}
});
C. mTimerViewModel.observe(new Observer
callAnyChangeUIMethodHere(aLong)
}
});
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 generates an implementation that inserts all parameters into the database in a single transaction.
B. 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.
C. Room removes a set of entities, given as parameters, from the database. It uses the primary keys to find the entities to delete.
Select correct statements about Hardware Abstraction Layer (HAL). (Choose two.)
A. The HAL provides standard interfaces that expose device hardware capabilities to the higher-level Java API framework.
B. The HAL function both as apps for users and to provide key capabilities that developers can access from their own app. For example, if your app would like to deliver an SMS message, you don't need to build that functionality yourself ? you can instead invoke whichever SMS app is already installed to deliver a message to the recipient you specify
C. The HAL consists of multiple library modules, each of which implements an interface for a specific type of hardware component, such as the camera or bluetooth module. When a framework API makes a call to access device hardware, the Android system loads the library module for that hardware component.
D. Using a HAL, not using a Linux kernel, allows Android to take advantage of key security features and allows device manufacturers to develop hardware drivers for a well-known kernel.
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/res/[your package name]
B. http://schemas.android.com/apk/[your package name]
C. http://schemas.android.com/[your package name]