Skip to content

Instantly share code, notes, and snippets.

@prasad091
Created March 14, 2017 08:52
Show Gist options
  • Save prasad091/7b1af1ca0983e5a486a7f2fce688de0c to your computer and use it in GitHub Desktop.
Save prasad091/7b1af1ca0983e5a486a7f2fce688de0c to your computer and use it in GitHub Desktop.
package com.kgisl.sharetruck.hub.ui.adapter;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.kgisl.sharetruck.hub.R;
import java.util.List;
/**
* Created by admin on 14-03-2017.
*/
public class ExampleAdapter extends RecyclerView.Adapter<ExampleAdapter.PaymentHistoryViewHolder> {
public Context context;
public List<String> list;
public ExampleAdapter(Context context, List<String> list) {
this.context = context;
this.list = list;
}
@Override
public PaymentHistoryViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.item_payment_history, parent, false);
return new PaymentHistoryViewHolder(view);
}
@Override
public void onBindViewHolder(PaymentHistoryViewHolder holder, int position) {
holder.textView.setText(list.get(position));
}
@Override
public int getItemCount() {
return list.size();
}
public class PaymentHistoryViewHolder extends RecyclerView.ViewHolder {
TextView textView;
public PaymentHistoryViewHolder(View itemView) {
super(itemView);
textView = (TextView) itemView.findViewById(R.id.payment_id);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment