Скрыть TextView, если он пустой

Всем привет. Как сделать чтобы TextView показывался когда там стоит какое-нибудь значение? В макете я его скрыл, и теперь никак не могу сделать видимым при заполненном поле.

binding.get().phone3TextView.setOnClickListener(view -> {

            String number3 = binding.get().phone3TextView.getText().toString();

            if (!(number3.trim().isEmpty() || number3.trim().equals("-"))) {
                Utils.callPhone(ShopProfileFragment.this, number3);
            }
        });
// For phone3
        if (shop.aboutPhone3.equals("")) {
            binding.get().phone3TextView.setText(Constants.DASH);
        } else {
            binding.get().phone3TextView.setText(shop.aboutPhone3);
        }

макет

<TextView
                    android:id="@+id/phone3TextView"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="42dp"
                    android:layout_marginTop="8dp"
                    android:layout_marginEnd="16dp"
                    android:paddingTop="4dp"
                    android:paddingBottom="4dp"
                    android:textAlignment="viewStart"
                    android:textSize="@dimen/font_body_size"
                    app:font='@{"normal"}'
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@+id/phone2TextView"
                    android:visibility="gone"/>

Ответы (1 шт):

Автор решения: Alex_Skvortsov

Нужно сделать так:

if (shop.aboutPhone3.equals("")) {
    binding.get().phone3TextView.setText(Constants.DASH);
    binding.get().phone3TextView.setVisibility(View.GONE);
} else {
    binding.get().phone3TextView.setText(shop.aboutPhone3);
    binding.get().phone3TextView.setVisibility(View.VISIBLE);
}
→ Ссылка