Associate-Android-Developer Exam Question 46

The following code snippet shows an example of an Espresso test:
  • Associate-Android-Developer Exam Question 47

    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?
  • Associate-Android-Developer Exam Question 48

    To build a debug APK, you can open a command line and navigate to the root of your project directory. To initiate a debug build, invoke the assembleDebug task:
    gradlew assembleDebug
    This creates an APK named [module_name]-debug.apk in [project_name]/[module_name]/build/outputs/apk/ Select correct statements about generated file. (Choose all that apply.)
  • Associate-Android-Developer Exam Question 49

    An example. In our ViewModelFactory (that implements ViewModelProvider.Factory) we have an instance of our Repository, named mRepository. Our ViewModel has such constructor:
    class MyViewModel(private val mRepository: MyRepository) : ViewModel() ...
    Next, in our ViewModelFactory create ViewModel method (overriden) looks like this:
    override fun <T : ViewModel?> create(modelClass: Class<T>): T {
    return try {
    //MISSED RETURN VALUE HERE"
    } catch (e: InstantiationException) {
    throw RuntimeException("Cannot create an instance of $modelClass", e)
    } catch (e: IllegalAccessException) {
    throw RuntimeException("Cannot create an instance of $modelClass", e)
    } catch (e: NoSuchMethodException) {
    throw RuntimeException("Cannot create an instance of $modelClass", e)
    } catch (e: InvocationTargetException) {
    throw RuntimeException("Cannot create an instance of $modelClass", e)
    }
    }
    What should we write instead of "//MISSED RETURN VALUE HERE"?