0

I have a problem adding TextView to a dialog fragment. The task looks simple, I have the following UI in my application.

enter image description here

Then I got the task to add just a TextView so that if I click on Weeks this textview changed its visibility from Gone to Visible. The xml for TextView looks like this.

enter image description here


 <TextView
        android:id="@+id/tv_weekdays_some_selection"
        style="@style/TextAppearanceDescription"
        android:layout_width="match_parent"
        android:layout_height="48dp"
        android:text="On Monday"
        android:gravity="center_vertical"
        android:textSize="14sp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/time_format_custom_repeat" />

But when I start the app I get the following Exception:

java.lang.NullPointerException: Missing required view with ID: debug:id/tv_weekdays_some_selection

The thing is that I don't even use it anywhere. Viewbinding sees this View, but for some reason it doen't want to show it in the dialog. I have tried to remove extra attributes from TextView, tried to clean cache and restart but it didn't help. Do you have an idea why it's happening?

Alex20280
  • 97
  • 6
  • Have you seen https://stackoverflow.com/questions/58554751/java-lang-nullpointerexception-missing-required-view-with-id – Zain Feb 07 '23 at 11:49

0 Answers0