Advertisement
Carlos_Chaves

Sorte

Jan 11th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.66 KB | None | 0 0
  1. package com.example.carloschaves.sorte
  2.  
  3. import android.support.v7.app.AppCompatActivity
  4. import android.os.Bundle
  5. import android.view.View
  6. import android.widget.RemoteViews
  7. import android.widget.TextView
  8. import java.util.*
  9.  
  10. class MainActivity : AppCompatActivity() {
  11.  
  12.     override fun onCreate(savedInstanceState: Bundle?) {
  13.         super.onCreate(savedInstanceState)
  14.         setContentView(R.layout.activity_main)
  15.     }
  16.  
  17.     fun sorteio (view: View){
  18.  
  19.         var texto = findViewById(R.id.textoSorteio) as TextView
  20.  
  21.         var numeroSorteado = Random().nextInt(11)
  22.  
  23.         texto.setText("Este é o número da sorte: $numeroSorteado")
  24.  
  25.     }
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement