Mobile App Dev Diary

Android (Java, Kotlin), iOS (Swift), Xamarin (C#)

Kotlin 1.1

Kotlin 1.1 / Screen transition with Intent

Screen transition in Kotlin version 1.1. When you transite to “NextActivity”, use this. val intent = Intent(applicationContext, startActivity(intent) Or you may want to define package-level function to instantiate…

Kotlin 1.1 / Display Toast

Display Toast in Kotlin version 1.1. Short-duration. Toast.makeText(this, "Good morning!", Toast.LENGTH_SHORT).show() Long-duration. Toast.makeText(this, "Good evening!", Toast.LENGTH_LONG).show()

Kotlin 1.1 / setOnClickListener

Set “setOnClickListener” to Button in Kotlin version 1.1. val myButton: Button = findViewById( as Button myButton.setOnClickListener { //onClick }