Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6995677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:03:37+00:00 2026-05-27T20:03:37+00:00

Right now i am using the ArrayList for My ListView and there is a

  • 0

Right now i am using the ArrayList for My ListView and there is a Custom ListView in My Application.

See the Image Below:
enter image description here

Now i am using this code to display the list and set the value to the listView:

    public void getOrders(){
        try{
//              if(employer)
//              {
                    System.out.println("You are in Employer");
                    m_orders = new ArrayList<Order>();
                    payListForEmployer = new String[] {"Tax Code","Pay period Begin","Pay Frequency","Salary/Wage per pay",
                            "Net or Gross Amount","KiwiSaver Member","Employee Deduction","Employee Contributions",
                            "Complying Fund Member","Fund Contribution","ESCT Tax Rate","Child Support Deduction","Payroll giving donation"};

                    Order o[]=new Order[payListForEmployer.length];
                    System.out.println("The Length of payListEmployer is: "+payListForEmployer.length);

                    for (int i = 0; i < payListForEmployer.length; i++) 
                    {
                        o[i]=new Order();
                        o[i].setOrderName(payListForEmployer[i]);

                        // for TAXCODE
                        if(i==0) {
                            taxCodeValue = PAYEEmployerDetail.taxCodeFinalValue;
                            if((taxCodeValue==null)) {
                                taxCodeValue = "Please select";
                            }
                            o[i].setOrderStatus(taxCodeValue);
                            //System.out.println("The Value is: "+o[i].getOrderStatus());

                        }
                        // for Pay Period Begin
                        if(i==1) {
                            //payPeriodValue = myPrefs.getString("payperiod", "12 09 2011");
                            payPeriodValue =  PAYEEmployerDetail.payPeriodFinalValue;
                            if((payPeriodValue==null)) {
                                payPeriodValue = "--/--/----";
                            }
                            o[i].setOrderStatus(payPeriodValue);
                            //System.out.println("The Value is: "+o[i].getOrderStatus());
                        }
                        // for Pay frequency
                        if(i==2) {
                            //payFrequencyValue = myPrefs.getString("payfrequency", "Weekly");
                            payFrequencyValue =  PAYEEmployerDetail.payFrequencyFinalValue;
                            if((payFrequencyValue==null)) {
                                payFrequencyValue = "Please select";
                            }
                            o[i].setOrderStatus(payFrequencyValue);
                            //System.out.println("The Value is: "+o[i].getOrderStatus());
                        }
                        // for salary / wage
                        if(i==3) {
                            salaryWageValue =  PAYEEmployerDetail.salaryWageFinalValue;
                            if((salaryWageValue==null)||(salaryWageValue.equals(""))) {
                                salaryWageValue = "$0";
                            }
                            else{
                                salaryWageValue = "$"+salaryWageValue;
                            }
                            o[i].setOrderStatus(salaryWageValue);
                            //System.out.println("The Value is: "+o[i].getOrderStatus());
                        }
                        // For Gross / Net
                        if(i==4) {

                            o[i].setOrderStatus("Gross");
                            //System.out.println("The Value is: "+o[i].getOrderStatus());
                        }

                        // for KiwiSaver Member 
                        if(i==5){
                            kiwiSaverMemberValue = PAYEEmployerDetail.kiwiSaverMemberFinalValue;
                            if((kiwiSaverMemberValue==null)||(kiwiSaverMemberValue.equals(""))){
                                kiwiSaverMemberValue = "No";
                            }else{
                                kiwiSaverMemberValue = PAYEEmployerDetail.kiwiSaverMemberFinalValue;
                            }
                            o[i].setOrderStatus(kiwiSaverMemberValue);
                        }

                        // for KS Employee Deduction    
                        if(i==6) {
                            employeeDeductionValue =  PAYEEmployerDetail.employeeDeductionFinalValue;
                            if((employeeDeductionValue==null)||(employeeDeductionValue.equals(""))) {
                                employeeDeductionValue = "0%";
                            }
                            o[i].setOrderStatus(employeeDeductionValue);
                            //System.out.println("The Value is: "+o[i].getOrderStatus());
                        }
                        // for KS Employee Contribution
                        if(i==7) {
                            employeeContributionValue =  PAYEEmployerDetail.employeeContributionFinalValue;
                            if((employeeContributionValue==null)||(employeeContributionValue.equals(""))) {
                                employeeContributionValue = "0%";
                            }
                            else{
                                employeeContributionValue = employeeContributionValue+"%";
                            }
                            o[i].setOrderStatus(employeeContributionValue);
                            //System.out.println("The Value is: "+o[i].getOrderStatus());
                        }

                        // for Complying Fund Member
                        if(i==8){
                            complyingFundMemberValue = PAYEEmployerDetail.complyingFundMemberFinalValue;
                            if((complyingFundMemberValue==null)||(complyingFundMemberValue.equals(""))){
                                complyingFundMemberValue = "No";
                            }else{
                                complyingFundMemberValue = PAYEEmployerDetail.complyingFundMemberFinalValue;
                            }
                            o[i].setOrderStatus(complyingFundMemberValue);
                        }
                        // for Fund Contribution
                        if(i==9){
                            fundContributionValue =  PAYEEmployerDetail.fundContributionFinalValue;
                            if((fundContributionValue==null)||(fundContributionValue.equals(""))) {
                                fundContributionValue = "$0";
                            }
                            else{
                                fundContributionValue = "$"+fundContributionValue;
                            }
                            o[i].setOrderStatus(fundContributionValue);

                        }
                        // for ESCT Tax Rate
                        if(i==10){
                            ESCTTaxRateValue =  PAYEEmployerDetail.ESCTTaxRateFinalValue;
                            if((ESCTTaxRateValue==null)||(ESCTTaxRateValue.equals(""))) {
                                ESCTTaxRateValue = "0%";
                            }
                            o[i].setOrderStatus(ESCTTaxRateValue);
                        }
                        // for Child Support Deduction
                        if(i==11) {
                            childSupportDeductionValue =  PAYEEmployerDetail.childSupportDeductionFinalValue;
                            if((childSupportDeductionValue==null)||(childSupportDeductionValue.equals(""))) {
                                childSupportDeductionValue = "$0";
                            }
                            else{
                                childSupportDeductionValue = "$"+childSupportDeductionValue;
                            }
                            o[i].setOrderStatus(childSupportDeductionValue);
                            //System.out.println("The Value is: "+o[i].getOrderStatus());
                        }

                        // for Payroll giving donation
                        if(i==12) {
                            payrollDonationValue =  PAYEEmployerDetail.payrollDonationFinalValue;
                            if((payrollDonationValue==null)||(payrollDonationValue.equals(""))) {
                                payrollDonationValue = "$0";
                            }
                            else{
                                payrollDonationValue = "$"+payrollDonationValue;
                            }
                            o[i].setOrderStatus(payrollDonationValue);
                            //System.out.println("The Value is: "+o[i].getOrderStatus());
                        }
                        m_orders.add(o[i]);
                        //lv.invalidate();
//                      System.out.println("==> TaXCode Value: "+PAYEEmployerDetail.taxCodeFinalValue);
//                      System.out.println("==> PAyPeriod Value: "+PAYEEmployerDetail.payPeriodFinalValue);
//                      System.out.println("==> PayFrequency Value: "+PAYEEmployerDetail.payFrequencyFinalValue);
//                      System.out.println("==> Salary/Wage Value: "+PAYEEmployerDetail.salaryWageFinalValue);
//                      System.out.println("==> Gross/Net Value "+"STATIC VALUE = GROSS");
//                      System.out.println("==> Employee Deduction Value "+PAYEEmployerDetail.employeeDeductionFinalValue);
//                      System.out.println("==> Employee Contribution Value "+PAYEEmployerDetail.employeeContributionFinalValue);
//                      System.out.println("==> Child Support Deduction Value "+PAYEEmployerDetail.childSupportDeductionFinalValue);
//                      System.out.println("==> PayRoll Donation Value "+PAYEEmployerDetail.payrollDonationFinalValue);
//                      
                    }

                Thread.sleep(100);
                Log.i("ARRAY", ""+ m_orders.size());
            } catch (Exception e) { 
                e.printStackTrace();
        }
        runOnUiThread(returnRes);
    }




 viewOrders = new Runnable(){
        @Override
        public void run() {
            getOrders();
        }
    };

    thread =  new Thread(null, viewOrders, "MagentoBackground");
    thread.start();

private Runnable returnRes = new Runnable() {

        @Override
        public void run() {
            if(m_orders != null && m_orders.size() > 0){

                m_adapter.notifyDataSetChanged();
                for(int i=0;i<m_orders.size();i++)
                    m_adapter.add(m_orders.get(i));
            }
           // m_ProgressDialog.dismiss();
            m_adapter.notifyDataSetChanged();
        }
};

and the OrderAdapter is like:

private class OrderAdapter extends ArrayAdapter<Order> {

    private ArrayList<Order> items;

    public OrderAdapter(Context context, int textViewResourceId, ArrayList<Order> items) {
            super(context, textViewResourceId, items);
            this.items = items;
    }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
            View v = convertView;
            if (v == null) {
                LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                v = vi.inflate(R.layout.paye_list_row, null);
            }
            Order o = items.get(position);
            if (o != null) {
                    TextView tt = (TextView) v.findViewById(R.id.toptext);
                    TextView bt = (TextView) v.findViewById(R.id.value);

                    if (tt != null) {
                          tt.setText(o.getOrderName()); // Setting the Value here                            
                    }
                    if(bt != null){
                          bt.setText(o.getOrderStatus()); // Setting the Value here
                          System.out.println("The "+o.getOrderName()+" Value is: "+o.getOrderStatus());

                    }
            }
            return v;
    }
}

There is also one Order class where i am going to get and set the Value by getter setter method.

Now i want to implement such thing for multiple employee. Example: right now it is for one emplpoyee, and if uesr click on add button, then present all the value of orderStatus should be stored. and after that i should be able to add the another employee detail (data).

I also want to go to Next Employee, to previoue Employee and also delete that shown employee.

So how it is possible with the HashMap? or mY code is good enough to implement it ?
Please help me for that.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:03:38+00:00Added an answer on May 27, 2026 at 8:03 pm

    Instead of using only one employee object, you could use an ArrayList<Employee> and use that one.

    As you modify data, you should think about when to save it. Possible would be to save every change, or just to save if you change the employee.

    I would recommend to save the data in the database, so you can easily read and write them.

    A small tip: You should refactor your if (i==1) ... to a switch/case for more maintainability.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right now, I am using this code to add an item to a listView:
We are using a Java EE application and we are right now using Informix
Right now I am using this to export a repeater (with multiple nested repeaters)
Right now I am using a list, and was expecting something like: verts =
Right now I currently using transactional replication with updatable subscription. Is there any ways
I am right now using this extended stored procedure in one of the test
Right now using SQLite i write the below (I may move to either mysql
Running a rails site right now using SQLite3. About once every 500 requests or
Right now we are using PostgreSQL 8.3 (on Linux) as a database backend to
Right now I'm using exec to redirect stderr to an error log with exec

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.