What is Activity?

A screen in the Android app’s user interface is called an Android activity. An Android app could have one or more screens, meaning that there may be many different activities on a single app. The main activity usually opens first to give the user access to these other activities.

Activity is a component that provides the user interface to do something. It can contain other components like views or services and it will be hosted by an Android system’s process, but there are exceptions for some apps which have their own processes. Activities can’t exist without Intents (which start them) or Intent Filters (which decide what they should do).

const val EXTRA_MESSAGE = "com.androidnames.test_app.MESSAGE"

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {

    fun sendMessage(view: View) {
        val editText = findViewById<EditText>(R.id.editText)
        val message = editText.text.toString()
        val intent = Intent(this, DisplayMessageActivity::class.java).apply {
            putExtra(EXTRA_MESSAGE, message)