コード例 #1
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {

    View view = convertView;

    if (view == null) {
      LayoutInflater inflater;
      inflater = LayoutInflater.from(getContext());
      view = inflater.inflate(R.layout.item_customer, null);
    }

    Customer customer = getItem(position);

    if (customer != null) {
      // Find Items from XML
      TextView textName = (TextView) view.findViewById(R.id.textView_customer_name);
      TextView textPhone = (TextView) view.findViewById(R.id.textView_customer_phone);
      TextView textEmail = (TextView) view.findViewById(R.id.textView_customer_email);

      // Populate Items on XML
      textName.setText(customer.getFullName());
      textPhone.setText(ApplicationHelper.printPhone(customer.getPhone()));
      textEmail.setText(customer.getEmail());
    }
    return view;
  }
コード例 #2
0
  private String[] getCustomerNames() {
    // Get the list of all Customers
    customerList = DBFunctions.getCustomers("", getApplicationContext());
    // Variable to gather the list of names
    String names = "";

    if (customerList.size() > 0) {
      for (Customer c : customerList) {
        names += c.getFullName() + ";";
      }
    }

    if (customerList.size() > 0) { // Add the default selector
      names += "SELECT A CUSTOMER";
    } else { // Add the default selector if there are no Customers
      names += "NO CUSTOMERS";
    }

    // Return names as an array
    return names.toUpperCase().split(";");
  }