Associate-Android-Developer Exam Question 46

What is demonstrated by the code below?
// RawDao.kt
@Dao
interface RawDao {
@RawQuery
fun getUserViaQuery(query: SupportSQLiteQuery?): User?
}
// Usage of RawDao
...
val query =
SimpleSQLiteQuery("SELECT * FROM User WHERE id = ? LIMIT 1",
arrayOf<Any>(sortBy))
val user = rawDao.getUserViaQuery(query)
...
  • Associate-Android-Developer Exam Question 47

    An example. In our ViewModelFactory (that implements ViewModelProvider.Factory) we have an instance of our Repository, named mRepository. Our ViewModel has such constructor:
    public MyViewModel(MyRepository myRepository)...
    Next, in our ViewModelFactory create ViewModel method (overriden) looks like this:
    @NonNull
    @Override
    public <T extends ViewModel> T create(@NonNull Class<T> modelClass) { try {
    //MISSED RETURN VALUE HERE
    } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { throw new RuntimeException("Cannot create an instance of " + modelClass, e);
    }
    }
    What should we write instead of "//MISSED RETURN VALUE HERE"?
  • Associate-Android-Developer Exam Question 48

    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.)
  • Associate-Android-Developer Exam Question 49

    Interface for a callback to be invoked when a shared preference is changed. Interface is named:
  • Associate-Android-Developer Exam Question 50

    SharedPreferences.Editor is an interface used for modifying values in a SharedPreferences object. All changes you make in an editor are batched, and not copied back to the original SharedPreferences until you call: