Using buttons and TextView widgets from our layout with a little help from interfaces

To follow along with this project, create a new Android Studio project, call it Kotlin Meet UI, and choose the Empty Activity template. You can find the code and the XML layout code in the Chapter12/Kotlin Meet UI folder.

First, let's build a simple UI by observing the following steps:

  1. In the editor window of Android Studio, switch to activity_main.xml and make sure you are on the Design tab.
  2. Delete the auto-generated TextView, the one that reads "Hello world!".
  3. Add a TextView widget to the top-center of the layout.
  4. Set its text property to 0, its id property to txtValue, and its textSize to 40sp. Pay careful attention to the case of the id value. It has an uppercase ...

Get Android Programming with Kotlin for Beginners now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.