Modifying the application

We have learned how to create an app based on RecyclerView in Chapter 9, Creating an Application, so we can just run through the concept of this app. We have a user data class with the ID and username. We will insert 100 users in the database and show in a custom RecyclerView. We also use a UserItemAdapter to customize the RecyclerView.

Clone this project if you want: https://github.com/PacktPublishing/Learn-Spring-for-Android-Application-Development/tree/master/Chapter10/TestingWithEspresso.

In this project, you find the MainActivity.kt where you can find a list view. Here is a piece of code from this class:

----
----
userLists.adapter = UserItemAdapter(this, userList)
----
----

Here, the userLists is the RecyclerView and we have the UserItemAdapter custom adapter of a UserModel. Here, the UserModel code is where we take the ID and name of a user:

data class User(var userID: Int, var username: String)

Now, we will test this list view using Espresso with some major functions that are frequently used in our projects. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.14.134.130