class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) val myButton: Button = findViewById(R.id.myButton) val myText: TextView = findViewById(R.id.textView) myButton.setOnClickListener { myText.text = "Hello, Kotlin!" } } } Use code with caution. Copied to clipboard 6. Running and Debugging : Click the Green Hammer icon to compile. Run : Click the Green Play icon to launch on the emulator.

The logic resides in MainActivity.kt . This class is the entry point of your app. Steps to Connect UI to Code: : This function runs when the app starts.

: Choose API 24 (Android 7.0) or higher to ensure compatibility with 90%+ of devices.

: This is the official IDE (Integrated Development Environment).