0% found this document useful (0 votes)
2 views2 pages

Android Whenstatement Code

Uploaded by

ajmalaima07
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Android Whenstatement Code

Uploaded by

ajmalaima07
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Android Project Code

package [Link]

import [Link]

import [Link]

import [Link]

import [Link]

import [Link]

import [Link]

import [Link]

import [Link]

class MainActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {

[Link](savedInstanceState)

enableEdgeToEdge()

setContentView([Link].activity_main)

[Link](findViewById([Link])) { v, insets ->

val systemBars = [Link]([Link]())

[Link]([Link], [Link], [Link], [Link])

insets

val inputNumber = findViewById<EditText>([Link])

val checkButton = findViewById<Button>([Link])


val resultText = findViewById<TextView>([Link])

[Link] {

val number = [Link]().toIntOrNull()

val day = when(number) {

1 -> "Monday"

2 -> "Tuesday"

3 -> "Wednesday"

4 -> "Thursday"

5 -> "Friday"

6 -> "Saturday"

7 -> "Sunday"

else -> "Invalid number"

[Link] = day

You might also like