Issue
What i am trying to do is take input from the user and on button click event i want to display that EditText
input on TextView
. On button click listener, textView should display the input string in All caps and then clicking the same button it should convert that string into lowercase an show it on TextView
. How can I achieve this?
This is what i have tried.
var userInput = findViewById<EditText>(R.id.editText)
var caseButton = findViewById<Button>(R.id.upperLowerButton)
var caseView = findViewById<TextView>(R.id.textUpperLower)
caseButton.setOnClickListener {
caseView.text = userInput.text
}
Solution
You can use something like:
val uppercase = userInput.text.toString().toUpperCase()
val lowerCase = uppercase.toLowerCase()
Answered By - Gabriele Mariotti
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.