To Examples
KotlinGreeter Example
Goal
- Create an Android project using Kotlin as the language for the activity file.
Directions
- Create an Android project named KotlinGreeter, setting Kotlin as the
language instead of Java. Add a class file named Greeter.kt. Then replace the default layout and activity files with these
files:
activity_main.xml
MainActivity.java
- The layout file is changed to a LinearLayout with these widgets: EditText, TextView, Button.
- When the button is clicked, take the name in the EditText widget (for example, Larry), compose a greeting (in this case Hello, Larry),
and display the greeting in the TextView widget.