I would like to inquire about Android EditText listener integration. – Solved

()

hello.

I ended up using Android after 20 years of development.

Buy a book called “This is Android” (3rd edition, Don-ho Go, Hanbit Media)

I am following along step by step.

When you enter a value in the edit text, the addTextChangedListener() listener is called.

This is a simple example of recording logs. It compiles, but no logs are recorded.

I’ve tried searching the author’s website or Googling to no avail, so I’d like to inquire.

1. Create edit text and connect text view

I created edittext as shown below and connected it to the text view above.

I would like to inquire about Android EditText listener integration. - Solved
2. Open build.gradle.kts and add viewBinding = true as shown below.

As shown in the book, I clicked [Sync Now] in the upper right corner.

I would like to inquire about Android EditText listener integration. - Solved3. MainActivity.kt

And create a binding property as shown below,

Call setContentView(binding.root),

addTextChangedListener() has been linked.

And when I took a screenshot to upload it, there was another setContentView() below. (I found it while writing.)

Is it because of this?

I would like to inquire about Android EditText listener integration. - Solvedyes. That’s right. ㅠㅠ

I commented out the second setContentView() function and it works as desired.

I would like to inquire about Android EditText listener integration. - SolvedHaha, it’s been a while… I’m asking a question and looking for an answer.

Since this book was published in 2022, there are some differences from the latest Android Studio.

I thought about why it wouldn’t work, took a screenshot, and it was a waste to do it, so I’ll just upload it.

Thank you to everyone who read this far. ^^

How useful was this post?

Click on a star to rate it!

Average rating / 5. Vote count:

No votes so far! Be the first to rate this post.

Leave a Comment