package com.example.activityconcept
import android.os.Bundle
import android.widget.Button
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
class SimpleActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_simple)
val showToastButton: Button = findViewById(R.id.button_show_toast)
showToastButton.setOnClickListener {
Toast.makeText(this, "Button clicked!", Toast.LENGTH_SHORT).show()
}
}
}We created a SimpleActivity that extends AppCompatActivity. In onCreate, we set the layout to activity_simple. We find the Button by its ID and set a click listener. When clicked, it shows a Toast message 'Button clicked!'. The layout contains a TextView and a Button arranged vertically and centered horizontally.