внеси изменения в xm , чтобы StocksFragment заработал корректно : <androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/product_card"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="10dp"
    android:elevation="6dp"
    app:cardCornerRadius="8dp">

<RelativeLayout
android:layout_width="match_parent"
    android:layout_height="wrap_content">

<ImageView
android:id="@+id/product_image"
    android:layout_width="match_parent"
    android:layout_height="250dp"
    android:scaleType="centerCrop"
    android:src="@drawable/food_1" />

<TextView
android:id="@+id/discount"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@color/white"
    android:layout_alignParentTop="true"
    android:layout_alignParentStart="true"
    android:padding="5dp"
    android:text="Товар подешевел на 30%"
    android:textSize="18sp"
    android:textStyle="bold" />

<TextView
android:id="@+id/new_price"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentEnd="true"
    android:layout_alignParentTop="true"
    android:layout_marginEnd="10dp"
    android:layout_marginTop="10dp"
    android:text="New Price"
    android:textColor="#EC0909"
    android:textSize="22sp"
    android:textStyle="bold" />

<TextView
android:id="@+id/product_name"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/product_image"
    android:layout_marginTop="10dp"
    android:gravity="center"
    android:padding="10dp"
    android:text="Product Name"
    android:textSize="22sp"
    android:textStyle="bold" />

<RelativeLayout
android:id="@+id/price_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/product_name"
    android:background="@color/white">

<TextView
android:id="@+id/old_price"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentStart="true"
    android:layout_marginStart="10dp"
    android:layout_marginTop="10dp"
    android:text="Old Price"
    android:textColor="@android:color/darker_gray"
    android:textSize="16sp" />

<TextView
android:id="@+id/price_separator"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@id/old_price"
    android:layout_centerHorizontal="true"
    android:text="|"
    android:textColor="@android:color/darker_gray"
    android:textSize="16sp" />

<TextView
android:id="@+id/percentage_off"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@id/old_price"
    android:layout_alignParentEnd="true"
    android:layout_marginEnd="10dp"
    android:text="-30%"
    android:textColor="#EC0909"
    android:textSize="16sp" />

    </RelativeLayout>

<Button
android:id="@+id/goRestaurantButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@id/price_layout"
    android:layout_alignParentEnd="true"
    android:layout_marginTop="10dp"
    android:layout_marginEnd="10dp"
    android:text="Перейти в ресторан" />

    </RelativeLayout>

    </androidx.cardview.widget.CardView>package com.example.myapp_2.Data.Discount_Get_table;

import android.os.Bundle;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;

import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.ViewPager;

import com.example.myapp_2.Data.Discount_Get_table.ProductAdapter1;
import com.example.myapp_2.Data.Discount_Get_table.StocksAdapter;
import com.example.myapp_2.Data.Discount_Get_table.StocksModel;
import com.example.myapp_2.Data.List_1.Product;
import com.example.myapp_2.R;

import java.util.ArrayList;
import java.util.List;

public class StocksFragment extends Fragment {

    ViewPager viewPager;
    StocksAdapter adapter;
    ArrayList<StocksModel> stocksModelArrayList;
    ProductAdapter1 productAdapter;
    List<Product> products;

    private List<Product> getProducts() {
        List<Product> products = new ArrayList<>();

        Product product1 = new Product("Product 1", "Description 1", R.drawable.food_3_1jpg, 0.0f);
        products.add(product1);

        Product product2 = new Product("Product 2", "Description 2", R.drawable.food_1_1, 0.0f);
        products.add(product2);

        Product product3 = new Product("Product 3", "Description 3", R.drawable.food_1_4, 0.0f);
        products.add(product3);

        Product product4 = new Product("Product 4", "Description 4", R.drawable.food_1_1, 0.0f);
        products.add(product4);

        Product product5 = new Product("Product 5", "Description 5", R.drawable.food_1_1, 0.0f);
        products.add(product5);

        Product product6 = new Product("Product 6", "Description 6", R.drawable.food_1_1,0.0f);
        products.add(product6);

        Product product7 = new Product("Product 7", "Description 7", R.drawable.food_3_2,0.0f);
        products.add(product7);

        Product product8 = new Product("Product 8", "Description 8", R.drawable.food_3_3,0.0f);
        products.add(product8);

        Product product9 = new Product("Product 9", "Description 9", R.drawable.food_1_1,0.0f);
        products.add(product9);

        Product product10 = new Product("Product 10", "Description 10", R.drawable.food_1_1,0.0f);
        products.add(product10);

        return products;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_stocks, container, false);
        Animation anim = AnimationUtils.loadAnimation(getActivity(), R.anim.fragment_transition_animation);
        anim.setDuration(200);
        view.startAnimation(anim);
        RecyclerView recyclerView = view.findViewById(R.id.recyclerView);

        stocksModelArrayList = new ArrayList<>();
        stocksModelArrayList.add(new StocksModel("Title1", "Description1", R.drawable.food_3));
        stocksModelArrayList.add(new StocksModel("Title2", "Description2", R.drawable.food_4));
        stocksModelArrayList.add(new StocksModel("Title2", "Description2", R.drawable.food_1_2));

        viewPager = view.findViewById(R.id.viewPager);
        adapter = new StocksAdapter(getContext(), stocksModelArrayList);
        viewPager.setAdapter(adapter);

        final Handler handler = new Handler();
        final Runnable runnable = new Runnable() {
            @Override
            public void run() {
                int currentItem = viewPager.getCurrentItem();
                int totalItems = viewPager.getAdapter().getCount();
                int nextItem = currentItem == totalItems - 1 ? 0 : currentItem + 1;
                viewPager.setCurrentItem(nextItem);
                handler.postDelayed(this, 3000);
            }
        };
        handler.postDelayed(runnable, 3000);

        products = getProducts();
        productAdapter = new ProductAdapter1(getContext(), products);
        recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
        recyclerView.setAdapter(productAdapter);

        return view;
    }
}