Filter by Category




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

0
(0)

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.

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.

3. 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?

yes. That’s right. ㅠㅠ

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

Haha, 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 0 / 5. Vote count: 0

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

Leave a Comment