Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import android.content.Context;
- import android.view.LayoutInflater;
- import android.view.View;
- import android.view.ViewGroup;
- import android.widget.BaseAdapter;
- import android.widget.ImageView;
- import android.widget.TextView;
- import com.validate.R;
- import java.util.List;
- import validate.com.classes.Vault_item_class;
- /**
- * Created by Mina on 30/06/2015.
- */
- public class vault_listadapter extends BaseAdapter {
- private List<Vault_item_class> vault_items;
- private Context context;
- private LayoutInflater inflater;
- TextView merchantName_tv, voucherType_tv, voucherName_tv, voucherDetail_tv, voucherValue_tv,
- issueDate_tv, expiryDate_tv, voucherCode_tv;
- ImageView barcode_imageview;
- public void vault_listadapter(Context context, List<Vault_item_class> vault_items) {
- this.context = context;
- this.vault_items = vault_items;
- this.inflater = LayoutInflater.from(context);
- }
- @Override
- public int getCount() {
- return vault_items.size();
- }
- @Override
- public Vault_item_class getItem(int position) {
- return vault_items.get(position);
- }
- @Override
- public long getItemId(int position) {
- return position;
- }
- @Override
- public View getView(int position, View convertView, ViewGroup parent) {
- ViewHolder holder;
- if (convertView == null) {
- convertView = inflater.inflate(R.layout.vault_item, null, false);
- holder = new ViewHolder();
- holder.merchantName_tv = (TextView) convertView.findViewById(R.id.merchantName_id);
- holder.voucherName_tv = (TextView) convertView.findViewById(R.id.voucherName_id);
- holder.voucherType_tv = (TextView) convertView.findViewById(R.id.voucherType_id);
- holder.voucherDetail_tv = (TextView) convertView.findViewById(R.id.voucherDetails_id);
- holder.voucherValue_tv = (TextView) convertView.findViewById(R.id.voucherVaule_id);
- holder.issueDate_tv = (TextView) convertView.findViewById(R.id.issueDate_id);
- holder.expiryDate_tv = (TextView) convertView.findViewById(R.id.expiryDate_id);
- holder.voucherCode_tv = (TextView) convertView.findViewById(R.id.voucherCode_id);
- holder.barcode_imageview = (ImageView) convertView.findViewById(R.id.barcodeimg_id);
- convertView.setTag(holder);
- } else {
- holder = (ViewHolder) convertView.getTag();
- }
- return convertView;
- }
- static class ViewHolder {
- TextView merchantName_tv, voucherType_tv, voucherName_tv, voucherDetail_tv, voucherValue_tv,
- issueDate_tv, expiryDate_tv, voucherCode_tv;
- ImageView barcode_imageview;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement