0

Here is the github link:

https://github.com/dunow0033/BudgetTracker

Here is the XML for a button for updating a budget entry:

   <Button
       android:id="@+id/updateBtn"
       android:visibility="gone"
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:background="@color/green"
       android:padding="10dp"
       android:text="Update Transaction"
       android:layout_margin="10dp"
       android:textColor="@android:color/white"
       app:layout_constraintBottom_toBottomOf="parent"
       app:layout_constraintStart_toStartOf="parent"
       app:layout_constraintEnd_toEndOf="parent"
       app:layout_constraintTop_toBottomOf="@+id/linearLayout" />

  </androidx.constraintlayout.widget.ConstraintLayout>

As you can see the updateBtn at the bottom above has visibility set to gone. I have an addTextChangedListener in a fragment with the following:

binding.labelInput.addTextChangedListener {
               updateBtn.visibility = View.VISIBLE
               if(it!!.isNotEmpty())
                   labelLayout.error = null
           }

And it's not making the button visible when I click on the input box to change it. Any help is appreciated!!

2
  • Did you check if the text changed listener is actually being called?
    – m0skit0
    Commented Apr 13, 2023 at 20:20
  • 1
    Wow your question lead me to do some debugging, and I discovered that I had the addTextChangedListener inside another listener by mistake and so it wasn't being called. I took the text changed listener out of where it was, and it started working....thank you!!
    – bradd
    Commented Apr 14, 2023 at 14:35

0