String Templates

String templates are a very visual way of concatenating text strings.

You're going to love them, you'll see. Say goodbye to String.format() complexity.

Did you finish watching the video?

Now it's your turn to put string templates into practice.

Some exercises and some steps in this course will require code it's not worth you spend time on them. Your goal here is to learn Kotlin. So you'll see I include some parts of the code you need on each step.

In this case, to solve the exercise you will use a specific XML for the MainActivity, that you can copy from here:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal">
    <EditText
        android:id="@+id/message"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:hint="Message to show"/>
    <Button
        android:id="@+id/button"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Show"/>
</LinearLayout>

Complete and Continue  
Discussion

2 comments