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 7025679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:00:29+00:00 2026-05-28T00:00:29+00:00

I have made the ArrayList and addind the value one by one in it

  • 0

I have made the ArrayList and addind the value one by one in it by the coading. I can able to see that whole arrayList as like below code:

//  TO DISPLAY DATA
                for(int j=0;j<tempEmployerList.size();j++)
                {
                    System.out.println("================ Employee: "+(j+1)+"======================");
                    m = new Employer();
                    m=tempEmployerList.get(j);
                    //System.out.println("TaxCodeHeading: "+(j+1)+" = "+m.getOrderName());
                    System.out.println("TaxCode: "+(j+1)+" = "+m.getTaxcode());
                    System.out.println("PayPeriod: "+(j+1)+" = "+m.getPayPeriod());
                    System.out.println("Frequency: "+(j+1)+" = "+m.getPayFrequency());
                    System.out.println("Salary/Wage: "+(j+1)+" = "+m.getSalaryWage());
                    System.out.println("NetGross Amount: "+(j+1)+" = "+m.getNetGrossAmount());
                    System.out.println("KiwiSaverMember: "+(j+1)+" = "+m.getKiwiSaverMember());
                    System.out.println("Employee Deduction: "+(j+1)+" = "+m.getEmployeeDeduction());
                    System.out.println("Complying Fund Member: "+(j+1)+" = "+m.getComplyingFundMember());
                    System.out.println("Fund Contribution: "+(j+1)+" = "+m.getFundContribution());
                    System.out.println("ESCT Tax Rate: "+(j+1)+" = "+m.getESCTTaxRate());
                    System.out.println("Child Support Deduction: "+(j+1)+" = "+m.getChildSupportDeduction());
                    System.out.println("Payroll giving Donation: "+(j+1)+" = "+m.getPayrollDonation());
                }

TOTAL_EMPLOYEE=tempEmployerList.size();
empIndex = TOTAL_EMPLOYEE;

Now i want to view that every element of that array list on the one by one based on the next and previous button click.

So can anyone help me for that ?

I have try it like below code:

For nextButton click:

     Toast.makeText(getApplicationContext(), "Index is:"+empIndex, Toast.LENGTH_SHORT).show();
                 System.out.println("The Employer Size is: "+tempEmployerList.size());
                 if((empIndex)==TOTAL_EMPLOYEE){
                     Toast.makeText(getApplicationContext(), "There are no any Employee", Toast.LENGTH_SHORT).show();
                 }else{
                     if(empIndex == 0){
                         empIndex = empIndex+1;
                     }
                     empIndex = empIndex+1;
                     if(empIndex==TOTAL_EMPLOYEE){
                         Toast.makeText(getApplicationContext(), "There are no any Employee", Toast.LENGTH_SHORT).show();
                     }else{
                         System.out.println("the Index IS::::" +empIndex);
                         headerText.setText("Emp "+(empIndex));
                         //empIndex = empIndex + 1;
                         Employer m = new Employer();
                         int j = empIndex-1;
                         m=tempEmployerList.get(j);
                         //System.out.println("TaxCodeHeading: "+(j+1)+" = "+m.getOrderName());
                         System.out.println("TaxCode: "+(j)+" = "+m.getTaxcode());
                         System.out.println("PayPeriod: "+(j)+" = "+m.getPayPeriod());
                         System.out.println("Frequency: "+(j)+" = "+m.getPayFrequency());
                         System.out.println("Salary/Wage: "+(j)+" = "+m.getSalaryWage());
                         System.out.println("NetGross Amount: "+(j)+" = "+m.getNetGrossAmount());
                         System.out.println("KiwiSaverMember: "+(j)+" = "+m.getKiwiSaverMember());
                         System.out.println("Employee Deduction: "+(j)+" = "+m.getEmployeeDeduction());
                         System.out.println("Complying Fund Member: "+(j)+" = "+m.getComplyingFundMember());
                         System.out.println("Fund Contribution: "+(j)+" = "+m.getFundContribution());
                         System.out.println("ESCT Tax Rate: "+(j)+" = "+m.getESCTTaxRate());
                         System.out.println("Child Support Deduction: "+(j)+" = "+m.getChildSupportDeduction());
                         System.out.println("Payroll giving Donation: "+(j)+" = "+m.getPayrollDonation()); 
                         }
}

And for Previous Button clicke:

    case R.id.backButton:
                 System.out.println("Total Employee is: "+TOTAL_EMPLOYEE);
                 Toast.makeText(getApplicationContext(), "Index is:"+empIndex, Toast.LENGTH_SHORT).show();
                 if(empIndex == 0){
                     PAYEEmployerDetail.taxCodeFinalValue=null;
                     PAYEEmployerDetail.payPeriodFinalValue=null;
                     PAYEEmployerDetail.salaryWageFinalValue=null;
                     PAYEEmployerDetail.payFrequencyFinalValue=null;
                     PAYEEmployerDetail.employeeDeductionFinalValue=null;
                     PAYEEmployerDetail.employeeContributionFinalValue=null;
                     PAYEEmployerDetail.childSupportDeductionFinalValue=null;
                     PAYEEmployerDetail.payrollDonationFinalValue=null;
                     PAYEEmployerDetail.kiwiSaverMemberFinalValue=null;
                     PAYEEmployerDetail.complyingFundMemberFinalValue=null;
                     PAYEEmployerDetail.fundContributionFinalValue=null;
                     PAYEEmployerDetail.ESCTTaxRateFinalValue=null;
                     TOTAL_EMPLOYEE = 0;
                     empIndex = 0;
                     tempEmployerList = null;
                     employerList = null;
                     finish(); 
                 }else{
                     if(empIndex>TOTAL_EMPLOYEE)
                         empIndex = empIndex - (empIndex - TOTAL_EMPLOYEE);
                     empIndex = empIndex -1;
                     System.out.println("the Index IS :" +empIndex);
                     headerText.setText("Emp "+(empIndex+1));
                     Employer m = new Employer();
                     int j=empIndex;
                     m=tempEmployerList.get(j);
                     //System.out.println("TaxCodeHeading: "+(j+1)+" = "+m.getOrderName());
                     System.out.println("TaxCode: "+(j)+" = "+m.getTaxcode());
                     System.out.println("PayPeriod: "+(j)+" = "+m.getPayPeriod());
                     System.out.println("Frequency: "+(j)+" = "+m.getPayFrequency());
                     System.out.println("Salary/Wage: "+(j)+" = "+m.getSalaryWage());
                     System.out.println("NetGross Amount: "+(j)+" = "+m.getNetGrossAmount());
                     System.out.println("KiwiSaverMember: "+(j)+" = "+m.getKiwiSaverMember());
                     System.out.println("Employee Deduction: "+(j)+" = "+m.getEmployeeDeduction());
                     System.out.println("Complying Fund Member: "+(j)+" = "+m.getComplyingFundMember());
                     System.out.println("Fund Contribution: "+(j)+" = "+m.getFundContribution());
                     System.out.println("ESCT Tax Rate: "+(j)+" = "+m.getESCTTaxRate());
                     System.out.println("Child Support Deduction: "+(j)+" = "+m.getChildSupportDeduction());
                     System.out.println("Payroll giving Donation: "+(j)+" = "+m.getPayrollDonation());
}
}

Edited
I also want to Set the same for the delete functionality and for addindg the new data to that ArrayList. How to set the index while i am viewing the data and not at the last position.

So whats wrong in my code ?
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-28T00:00:30+00:00Added an answer on May 28, 2026 at 12:00 am

    Try something like this, you just need to increment the ArrayList position to get the next ArrayList Record and decrement the position to get the previous Record.

    int position = 0;
    

    Next Button:

      if(position < tempEmployerList.size() - 1){
          position++;
          tempEmployerList.get(position);
          // show the data here
      }
      else
        Log.d("TAG","Reached Last Record");
    

    Previous Button:

     if(position > 0){
           position--;        
           tempEmployerList.get(position);
        // show the data here
      }
      else
        Log.d("TAG","Reach First Record");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created an arraylist that is made up of custom objects. Basically the
I have an ArrayList as an Object(from reflection) and made my own class that
I have a ArrayList made up of different elements imported from a db, made
I have made a SVG image, or more like mini application, for viewing graphs
I have made some code which exports some details of a journal article to
I have made a custom UserControl i Vb.net (windows application). How can I add
I have made a program in c and wanted to see, how much memory
I have made a new windows service which works fine using barebone code (just
I have made a class which a form can inherit from and it handles
I have made a program that list all files and folders(f&f) locating on sd

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.