Advertisement

TrimwebsolutionsTrimwebsolutions

Problem and Solutions

android.widget.LinearLayout cannot be cast to android.widget.TextView at com.example.foodorderapp.Adapters.OrdersAdapter$viewHolder.<init> in android ?

By M.K. Verma · 4 May 2022

android.widget.LinearLayout cannot be cast to android.widget.TextView at com.example.foodorderapp.Adapters.OrdersAdapter$viewHolder.<init> in android ?

Remove the ID from Linearlayout and add to your textview-

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    **android:id="@+id/orderItemName"** //REMOVE THIS and add to your TEXTVIEW
    android:layout_width="match_parent"
    android:layout_height="120dp"
    android:orientation="vertical"
    android:padding="1dp">