Skip to content

Instantly share code, notes, and snippets.

@carlosgub
Created September 21, 2019 03:56
Show Gist options
  • Select an option

  • Save carlosgub/23589834bd8dc68756af62d4eb83e6e0 to your computer and use it in GitHub Desktop.

Select an option

Save carlosgub/23589834bd8dc68756af62d4eb83e6e0 to your computer and use it in GitHub Desktop.
val act = this
val layout = LinearLayout(act)
layout.orientation = LinearLayout.VERTICAL
val name = EditText(act)
val button = Button(act)
button.text = "Say Hello"
button.setOnClickListener {
Toast.makeText(act, "Hello, ${name.text}!", Toast.LENGTH_SHORT).show()
}
layout.addView(name)
layout.addView(button)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment