@Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        ParseUser currentUser = ParseUser.getCurrentUser();
        String role = currentUser.getString("role");
        if(convertView == null) {
            convertView = LayoutInflater.from(mContext).inflate(R.layout.product_list_item, null);
            holder = new ViewHolder();
            holder.companyNameLabel = (TextView) convertView.findViewById(R.id.companyName);
            holder.productNameLabel = (TextView) convertView.findViewById(R.id.productNameLabel);
            holder.priceNameLabel = (TextView) convertView.findViewById(R.id.productPriceLabel);
            holder.addItemButton = (Button) convertView.findViewById(R.id.btnAddToCart);
            holder.editItemButton = (Button) convertView.findViewById(R.id.btnEditButton);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
        if (role.equals("Company Account")) {
            holder.editItemButton.setVisibility(View.VISIBLE);
        }
        else if (role.equals("Personal Account")) {
            holder.addItemButton.setVisibility(View.VISIBLE);
        }
        final Product product = mProducts.get(position);
        holder.companyNameLabel.setText(product.getCompany());
        holder.productNameLabel.setText(product.getProductName());
        holder.priceNameLabel.setText(product.getPrice() + "");
        holder.addItemButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(mContext, CheckoutActivity.class);
                intent.putExtra("product", product.getProductName());
                mContext.startActivity(intent);
                //TODO: Add functionality for edit button
            }
        });
        return convertView;
    }
@Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        ParseUser currentUser = ParseUser.getCurrentUser();
        String role = currentUser.getString("role");
        if(convertView == null) {
            convertView = LayoutInflater.from(mContext).inflate(R.layout.product_list_item, null);
            holder = new ViewHolder();
            holder.companyNameLabel = (TextView) convertView.findViewById(R.id.companyName);
            holder.productNameLabel = (TextView) convertView.findViewById(R.id.productNameLabel);
            holder.priceNameLabel = (TextView) convertView.findViewById(R.id.productPriceLabel);
            holder.addItemButton = (Button) convertView.findViewById(R.id.btnAddToCart);
            holder.editItemButton = (Button) convertView.findViewById(R.id.btnEditButton);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
        if (role.equals("Company Account")) {
            holder.editItemButton.setVisibility(View.VISIBLE);
        }
        else if (role.equals("Personal Account")) {
            holder.addItemButton.setVisibility(View.VISIBLE);
        }
        final Product product = mProducts.get(position);
        holder.companyNameLabel.setText(product.getCompany());
        holder.productNameLabel.setText(product.getProductName());
        holder.priceNameLabel.setText(product.getPrice() + "");
        holder.addItemButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(mContext, CheckoutActivity.class);
                intent.putExtra("product", product.getProductName());
                mContext.startActivity(intent);
               
            }
        });
        return convertView;
    }
@override public view getview(int position, view convertview, viewgroup parent) { viewholder holder; parseuser currentuser = parseuser.getcurrentuser(); string role = currentuser.getstring("role"); if(convertview == null) { convertview = layoutinflater.from(mcontext).inflate(r.layout.product_list_item, null); holder = new viewholder(); holder.companynamelabel = (textview) convertview.findviewbyid(r.id.companyname); holder.productnamelabel = (textview) convertview.findviewbyid(r.id.productnamelabel); holder.pricenamelabel = (textview) convertview.findviewbyid(r.id.productpricelabel); holder.additembutton = (button) convertview.findviewbyid(r.id.btnaddtocart); holder.edititembutton = (button) convertview.findviewbyid(r.id.btneditbutton); convertview.settag(holder); } else { holder = (viewholder) convertview.gettag(); } if (role.equals("company account")) { holder.edititembutton.setvisibility(view.visible); } else if (role.equals("personal account")) { holder.additembutton.setvisibility(view.visible); } final product product = mproducts.get(position); holder.companynamelabel.settext(product.getcompany()); holder.productnamelabel.settext(product.getproductname()); holder.pricenamelabel.settext(product.getprice() + ""); holder.additembutton.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent intent = new intent(mcontext, checkoutactivity.class); intent.putextra("product", product.getproductname()); mcontext.startactivity(intent); } }); return convertview; }