This URL is invalid or the video is removed by the provider.

Button is having a click event we can configure the click event in 2 ways || Android Tutorials #2

Please login in order to report media.

  • Uploaded 8 months ago in the category How to programming

    In this video I have shown two ways of configuring click event in Button
    1.

    xml
    2.

    Kotlin

    xml approach
    in side the button tag we have to configure one attribute
    android:="myclick" here myclick is function name which will execute when button will click so we have to define the function body in side the MainActivity.kt file that funtion will receive one parameter which in View object like

    fun myclick(v: View){
    e1.text = t1.text
    }

    Kotlin Approach

    in kotlin approach we have to register button with Listener for this a method is there setListener(), in kotlin we can directly can this method with the id name of button like b1.setListener{

    }
    even if we don't have to override the () method like

    b1.setListener { it: View!
    e1.text=t1.text
    }

    -~-~~-~~~-~~-~-
    Please watch: "Employee Leave Management System Using PHP With Source Code"
    https://www.youtube.com/watch?v=PFWFtg-SyUo
    -~-~~-~~~-~~-~-

  • buttonclickeventconfigure2ways||androidtutorials