Page 399 - MDP2020-1
P. 399

················································································  명장양성프로젝트  【MDP】  과제발표회  자료집  Ⅰ    |  393


            ProductAdapter
            package  com.example.s_mart;


            import  android.view.LayoutInflater;

            import  android.view.View;
            import  android.view.ViewGroup;
            import  android.widget.ImageView;
            import  android.widget.TextView;



            import  androidx.annotation.NonNull;
            import  androidx.recyclerview.widget.RecyclerView;


            import  java.util.ArrayList;





            public  class  ProductAdapter  extends  RecyclerView.Adapter<ProductAdapter.ViewHolder>
            {



            private  final  ArrayList<ProductData>  dataset;


            public  ProductAdapter(ArrayList<ProductData>  myDataset)
            {
            dataset  =  myDataset;
            }



            class  ViewHolder  extends  RecyclerView.ViewHolder  {


            ImageView  product_image;
            TextView  textView_name;

            TextView  textView_price;


            public  ViewHolder(@NonNull  View  v)  {
            super(v);



            product_image  =  itemView.findViewById(R.id.imageView_product);
            textView_name  =  v.findViewById(R.id.textView_Name);
            textView_price  =  v.findViewById(R.id.textView_Price);
            }
            }



            @NonNull
   394   395   396   397   398   399   400   401   402   403   404