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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:41:36+00:00 2026-06-14T21:41:36+00:00

I am trying to add the items from my array into the listview but

  • 0

I am trying to add the items from my array into the listview but i always get an exception.

below is the code of how i add the items:

items.add(new SectionItem("President"));
                for(int a = 0; a <= presList.size(); a++)
                {
                    String name = presList.get(a);
                    String companyName = presList.get(a + 1);
                    Log.d("company name:", companyName);
                    items.add(new EntryItem(name,companyName));
                }

Logcat Output:

11-24 04:36:44.981: I/System.out(719): [潘国驹博士, 世界科技出版公司(董事主席)]
11-24 04:36:44.990: D/company name:(719): 世界科技出版公司(董事主席)
11-24 04:36:44.990: D/AndroidRuntime(719): Shutting down VM
11-24 04:36:44.990: W/dalvikvm(719): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
11-24 04:36:45.010: E/AndroidRuntime(719): FATAL EXCEPTION: main
11-24 04:36:45.010: E/AndroidRuntime(719): java.lang.IndexOutOfBoundsException: Invalid index 2, size is 2
11-24 04:36:45.010: E/AndroidRuntime(719):  at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251)
11-24 04:36:45.010: E/AndroidRuntime(719):  at java.util.ArrayList.get(ArrayList.java:304)
11-24 04:36:45.010: E/AndroidRuntime(719):  at com.scba.organization.CouncilList$LoadAllMembers$1.run(CouncilList.java:192)
11-24 04:36:45.010: E/AndroidRuntime(719):  at android.app.Activity.runOnUiThread(Activity.java:4170)
11-24 04:36:45.010: E/AndroidRuntime(719):  at com.scba.organization.CouncilList$LoadAllMembers.onPostExecute(CouncilList.java:184)
11-24 04:36:45.010: E/AndroidRuntime(719):  at com.scba.organization.CouncilList$LoadAllMembers.onPostExecute(CouncilList.java:1)
11-24 04:36:45.010: E/AndroidRuntime(719):  at android.os.AsyncTask.finish(AsyncTask.java:602)
11-24 04:36:45.010: E/AndroidRuntime(719):  at android.os.AsyncTask.access$600(AsyncTask.java:156)
11-24 04:36:45.010: E/AndroidRuntime(719):  at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:615)
11-24 04:36:45.010: E/AndroidRuntime(719):  at android.os.Handler.dispatchMessage(Handler.java:99)
11-24 04:36:45.010: E/AndroidRuntime(719):  at android.os.Looper.loop(Looper.java:137)
11-24 04:36:45.010: E/AndroidRuntime(719):  at android.app.ActivityThread.main(ActivityThread.java:4424)
11-24 04:36:45.010: E/AndroidRuntime(719):  at java.lang.reflect.Method.invokeNative(Native Method)
11-24 04:36:45.010: E/AndroidRuntime(719):  at java.lang.reflect.Method.invoke(Method.java:511)
11-24 04:36:45.010: E/AndroidRuntime(719):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
11-24 04:36:45.010: E/AndroidRuntime(719):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
11-24 04:36:45.010: E/AndroidRuntime(719):  at dalvik.system.NativeStart.main(Native Method)
  • 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-06-14T21:41:38+00:00Added an answer on June 14, 2026 at 9:41 pm

    use

    for(int a = 0; a <= presList.size()-1; a++)
    

    OR

    for(int a = 0; a < presList.size(); a++)
    

    instead of

    for(int a = 0; a <= presList.size(); a++)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im trying to add items to jagged array's, the data is being pulled from
I'm trying to create a player who can add and remove items from their
I'm trying to add items to a listbox,combobox, radiolist using reflection. The code I
I am trying to push new array item into existing array variable that has
I'm trying to add items to a dropdown list using a List of ListItems,
I'm trying to use the PowerShell Add-Member cmd on all the items in an
I am trying to manipulate SharePoint's default calendar to add, edit and delete items
I am trying to add a new menu item to Eclipse's popupmenus. It really
I am trying add picture boxes dynamically. My code is as PictureBox picture =
Dictionary<string,string> items = new Dictionary<string,string>(); IEnumerable<string> textvalues = from c in......//using linQ to query

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.