Advertisement
hamidms

inikoding_findviewbyid_kotlin

Sep 29th, 2018
445
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.52 KB | None | 0 0
  1. import android.support.v7.app.AppCompatActivity
  2. import android.os.Bundle
  3. import android.widget.Button
  4. import android.widget.Toast
  5.  
  6. class MainActivity : AppCompatActivity() {
  7.  
  8.     override fun onCreate(savedInstanceState: Bundle?) {
  9.         super.onCreate(savedInstanceState)
  10.         setContentView(R.layout.activity_main)
  11.  
  12.         var button = findViewById(R.id.btn_toast) as Button
  13.  
  14.         button.setOnClickListener {
  15.             Toast.makeText(this, "Hallo Human", Toast.LENGTH_LONG).show()
  16.         }
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement