Simple example of Button and Toast (Android Kotlin)

Dhanisa Mashilfa

action_primary.xml




    

        

MainActivity.kt

deal android_er.blogspot.com.myapp01

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.Perspective
import android.widget.Button
import android.widget.Toast

private lateinit var btnA: Button
non-public lateinit var btnB: Button

class MainActivity : AppCompatActivity() 
    override enjoyment onCreate(savedInstanceState: Bundle?) 
        tremendous.onCreate(savedInstanceState)
        setContentView(R.structure.action_primary)

        btnA = findViewById(R.id.btn_A)
        btnB = findViewById(R.id.btn_B)

        btnA.setOnClickListener(
             view: See ->
                Toast.makeText(
                    this,
                    "Button A pressed",
                    Toast.Length_Very long,
                ).show()
            ,
        )

        btnB.setOnClickListener(
             check out: Perspective ->
                Toast.makeText(
                    this,
                    "Button B pressed",
                    Toast.Length_Extended,
                ).demonstrate()
            ,
        )
    

Next Post

How To Create Effective Top of The Funnel Content

Not like the other sections of your marketing and advertising funnel, your leading-of-funnel offers a significant initial impact of your manufacturer. So, your ToFu ought to be crystal clear of bottlenecks to improve your advertising technique.  There are two most important means to generate an successful ToFu – 1) present […]
How To Create Effective Top of The Funnel Content