0
  • This text view is used by the recycler view adapter adapter

            <TextView
             android:id="@+id/note_item"
             android:layout_width="match_parent"
             android:layout_height="200dp"
             android:layout_marginStart="8dp"
             android:layout_marginTop="8dp"
             android:layout_marginEnd="16dp"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toTopOf="parent"
             tools:text="None" />
    
  • The following code is applied on the home fragment. It is using a recycler view which is adapting the above view.

           <soup.neumorphism.NeumorphCardView
               android:id="@+id/card_edit"
               android:layout_width="match_parent"
               android:layout_height="190dp"
               android:background="@color/background_color"
               app:layout_constraintTop_toTopOf="parent"
               app:layout_constraintStart_toStartOf="parent"
               app:layout_constraintEnd_toEndOf="parent">
    
                 <EditText
                     android:id="@+id/note"
                     android:inputType="text"
                     android:layout_width="488dp"
                     android:layout_height="48dp"
                     android:autofillHints="" />
             </soup.neumorphism.NeumorphCardView>
    
         <soup.neumorphism.NeumorphButton
             android:id="@+id/addButton"
             style="@style/Widget.Neumorph.Button"
             android:layout_width="150dp"
             android:layout_height="60dp"
             android:text="Add Note"
             app:layout_constraintHorizontal_bias="0.532"
             app:layout_constraintLeft_toLeftOf="parent"
             app:layout_constraintRight_toRightOf="parent"
             app:layout_constraintTop_toBottomOf="@id/card_edit" />
    
         <androidx.recyclerview.widget.RecyclerView
             android:id="@+id/recycler_view"
             android:layout_width="match_parent"
             android:layout_height="400dp"
             android:orientation="vertical"
             app:layout_constraintTop_toBottomOf="@id/addButton"
             tools:layout_editor_absoluteX="0dp"
             tools:layout_editor_absoluteY="259dp"
             app:layout_constraintLeft_toLeftOf="parent"
             app:layout_constraintRight_toRightOf="parent"/>
    
         <soup.neumorphism.NeumorphButton
             android:id="@+id/clearButton"
             style="@style/Widget.Neumorph.Button"
             android:layout_width="150dp"
             android:layout_height="40dp"
             android:layout_marginTop="50dp"
             android:text="Clear Note"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintHorizontal_bias="0.564"
             app:layout_constraintLeft_toLeftOf="parent"
             app:layout_constraintRight_toRightOf="parent"
             app:layout_constraintTop_toBottomOf="@id/recycler_view"
             app:layout_constraintVertical_bias="1.0" />
    

Here in all the views the width and height are greater than 0 but still I'm getting the same error.

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.notelocal, PID: 26959
    java.lang.IllegalArgumentException: width and height must be > 0
        at android.graphics.Bitmap.createBitmap(Bitmap.java:877)
        at android.graphics.Bitmap.createBitmap(Bitmap.java:856)
        at android.graphics.Bitmap.createBitmap(Bitmap.java:823)

[Error I'm getting] https://i.stack.imgur.com/deZvX.png

Aditya
  • 11
  • 2

1 Answers1

0

One of your views has a value that 0 or less than 0 on the width or height attributes. Make sure that layoutWidth and layoutHeight is set to a valid integer. It would be best to include the code that you already have or where you suspect the error might be coming from

ToxicFlame427
  • 355
  • 2
  • 13