0

I am trying to display an AlertDialog but I am getting below error because of the TextView (code is given below). The dialog works fine when I comment out this TextView code.

Here's the TextView code,

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Enter OTP"
    android:textSize="20dp"
    android:padding="@dimen/min_padding"/>

Here's the Logcat error,

android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class TextView
       Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class TextView
       Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 14 to dimension: type=0x4
Phantômaxx
  • 37,352
  • 21
  • 80
  • 110
Naren
  • 1

2 Answers2

1

Check the value of min_padding

You should create dimens.xml in the values folder .And min_padding has value .

Like this .

<resources>
    <dimen name="min_padding">10dp</dimen>
</resources>
KeLiuyue
  • 7,831
  • 4
  • 23
  • 39
0
  • Id is missing in textView
  • I think you are not accessing valid id

    <TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Enter OTP"
    android:textSize="20dp"
    android:id="@+id/textview"
    android:padding="5dp"/>
    
Vishal Yadav
  • 1,025
  • 4
  • 15
  • 30