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

    private Context context;

    private String Name;

    //List<Recycler_item> items;

    //int item_layout;


    private int rowLayout;

    //private List<Sight> sights;

    private List<Spot> spots;


    /*

    public RecyclerAdapter(List<Sight> sights, int rowLayout, Context context) {

        this.sights = sights;

        this.rowLayout = rowLayout;

        this.context = context;

    }*/

    public RecyclerAdapter(List<Spot> spots, int rowLayout, Context context) {

        this.spots = spots;

        this.rowLayout = rowLayout;

        this.context = context;

    }


    @Override

    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {

        View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_cardview, null);

        return new ViewHolder(v);


    }


    @TargetApi(Build.VERSION_CODES.JELLY_BEAN)

    @Override

    public void onBindViewHolder(ViewHolder holder, final int position) {


        //final Recycler_item item = items.get(position);

        //holder.title.setText(item.getTitle());

        //final Sight item = sights.get(position);


        Picasso.with(context)

                .load("http://smartguider-server.herokuapp.com/" + spots.get(position).getImage())

                .placeholder(R.drawable.building)

                .error(R.drawable.building)

                //.load("http://smartguider-server.herokuapp.com/images/hknu/Complex_N.jpg")

                .fit()

                .into(holder.image);

        holder.spotName.setText(spots.get(position).getName());

        holder.cardview.setOnClickListener(new View.OnClickListener() {

            @Override

            public void onClick( View v) {

                Toast.makeText(context,  spots.get(position).getName(), Toast.LENGTH_SHORT).show();

            }

        });

    }


    @Override

    public int getItemCount() {

        return spots.size();

        //return this.items.size();

    }


    public class ViewHolder extends RecyclerView.ViewHolder {

        //LinearLayout spotsLayout;

        ImageView image;

        TextView spotName;

        CardView cardview;


        public ViewHolder(View itemView) {

            super(itemView);

            image = (ImageView)itemView.findViewById(R.id.image);

            spotName = (TextView)itemView.findViewById(R.id.name);

            cardview = (CardView)itemView.findViewById(R.id.cardview);

        }

    }

}


//여기에 아이템별로 엑티비티 전환 클릭이벤트를 넣고 싶은데 어떻게 해야할까요???