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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:57:07+00:00 2026-05-23T05:57:07+00:00

**How to solve this ERROR/AndroidRuntime(328): Caused by: java.lang.IndexOutOfBoundsException: Invalid index 10, size is 10

  • 0

**How to solve this ERROR/AndroidRuntime(328):
Caused by:

java.lang.IndexOutOfBoundsException: Invalid index 10, size is 10
this problem …**

**Log cat:**

06-15 05:11:39.499: ERROR/AndroidRuntime(328): FATAL EXCEPTION: AsyncTask #2

06-15 05:11:39.499: ERROR/AndroidRuntime(328): java.lang.RuntimeException: An error 
occured while executing doInBackground()

06-15 05:11:39.499: ERROR/AndroidRuntime(328):     at android.os.AsyncTask$3.done(AsyncTask.java:200)

06-15 05:11:39.499: ERROR/AndroidRuntime(328):     at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)

06-15 05:11:39.499: ERROR/AndroidRuntime(328):     at java.util.concurrent.FutureTask.setException(FutureTask.java:124)

06-15 05:11:39.499: ERROR/AndroidRuntime(328):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)

06-15 05:11:39.499: ERROR/AndroidRuntime(328):     at java.util.concurrent.FutureTask.run(FutureTask.java:137)

06-15 05:11:39.499: ERROR/AndroidRuntime(328):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)

06-15 05:11:39.499: ERROR/AndroidRuntime(328):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)

06-15 05:11:39.499: ERROR/AndroidRuntime(328):     at java.lang.Thread.run(Thread.java:1096)

**06-15 05:11:39.499: ERROR/AndroidRuntime(328): Caused by: java.lang.IndexOutOfBoundsException: Invalid index 10, size is 10**

06-15 05:11:39.499: ERROR/AndroidRuntime(328):     at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:257)

06-15 05:11:39.499: ERROR/AndroidRuntime(328):     at java.util.ArrayList.get(ArrayList.java:311)

06-15 05:11:39.499: ERROR/AndroidRuntime(328):     at $MyGroupByCategorySync.doInBackground(GroupByCategoryProductSearchMainActivity.java:691)

06-15 05:11:39.499: ERROR/AndroidRuntime(328):     at android.os.AsyncTask$2.call(AsyncTask.java:185)

06-15 05:11:39.499: ERROR/AndroidRuntime(328):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)

06-15 05:11:39.499: ERROR/AndroidRuntime(328):     ... 4 more

Code :

 private void createSingleRow(String bycategory_info[],Drawable product_image)
        {
            Log.e("------------", ".........................................................................................");
            Log.v("-->","GroupByCategoryProductSearchMainActivity STARTING createSingleRow()");

            String productname = bycategory_info[1];
            String city = bycategory_info[4];
            String state = bycategory_info[4];
            final String strOfferid=bycategory_info[3];


//          for(int row_id=0;row_id<no_of_rows;row_id++)
//          {
             TableRow table_row = new TableRow(this);
             TextView tv_blank = new TextView(this);
             TextView tv_photo = new TextView(this);
             TextView txt_pname = new TextView(this);
             TextView txt_city = new TextView(this);
             TextView txt_state = new TextView(this);
             TextView img_line = new TextView(this);

             LinearLayout line_layout = new LinearLayout(this);
             LinearLayout row_layout = new LinearLayout(this);

             table_row.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT ,LayoutParams.FILL_PARENT));
             table_row.setPadding(0, 5, 0, 5);

             tv_blank.setWidth(11);


            tv_photo.setBackgroundDrawable(product_image);
            Log.i("--: VALUE :--", "PRODUCT IMAGE SET TO ROW = "+single_row_id+" "+product_image);
            tv_photo.setLayoutParams(new TableRow.LayoutParams(45 ,45));
            tv_photo.setGravity(Gravity.CENTER_VERTICAL);

            txt_pname.setBackgroundResource(R.drawable.empty);
            txt_pname.setText(productname);
            Log.i("--: VALUE :--", "PRODUCT NAME SET TO ROW = "+single_row_id+" "+productname);
            txt_pname.setTextColor(color_black);
            txt_pname.setTextSize(14);
            txt_pname.setWidth(110);
            txt_pname.setHeight(60);
            txt_pname.setPadding(10,0,0,0);
            txt_pname.setGravity(Gravity.LEFT);
            txt_pname.setGravity(Gravity.CENTER_VERTICAL);

            txt_city.setBackgroundResource(R.drawable.empty);
            txt_city.setText(city);
            Log.i("--: VALUE :--", "location NAME SET TO ROW = "+single_row_id+" "+city);
            txt_city.setTextColor(color_black);
            txt_city.setTextSize(13);
            txt_city.setWidth(65);
            txt_city.setHeight(60);
            txt_city.setPadding(15,0,0,0);
            txt_city.setGravity(Gravity.LEFT);
            txt_city.setGravity(Gravity.CENTER_VERTICAL);


            txt_state.setBackgroundResource(R.drawable.empty);
            txt_state.setText(state);
            Log.i("--: VALUE :--", "PRODUCT NAME SET TO ROW = "+single_row_id+" "+state);
            txt_state.setTextColor(color_black);
            txt_state.setTextSize(13);
            txt_state.setWidth(65);
            txt_state.setHeight(60);
            txt_state.setPadding(15,0,0,0);
            txt_state.setGravity(Gravity.LEFT);
            txt_state.setGravity(Gravity.CENTER_VERTICAL);



            img_line.setBackgroundResource(R.drawable.separater_line);
            img_line.setLayoutParams(new TableRow.LayoutParams(LayoutParams.FILL_PARENT ,2));
            line_layout.setGravity(Gravity.CENTER_HORIZONTAL);  
            //table_row.setBackgroundColor(color_white);
        /*  table_row.setGravity(Gravity.CENTER_VERTICAL);
            table_row.addView(tv_blank);
            table_row.addView(tv_photo);
            table_row.addView(btn_name);*/

            row_layout.setGravity(Gravity.CENTER_VERTICAL);
            row_layout.addView(tv_blank);
            row_layout.addView(tv_photo);
            row_layout.addView(txt_pname);
            row_layout.addView(txt_city);
            row_layout.addView(txt_state);


                    table_row.setOnClickListener(new OnClickListener() 
                    {
                        @Override
                        public void onClick(View v) 
                        {

                            XMLDataParser.parseXML(XMLDataParser.GROUP_PRODUCT_ITEM_DETAIL_PARSER_CODE,strOfferid);
                            Intent intent_show_detail  = new Intent(GroupByCategoryProductSearchMainActivity.this,GroupByCategoryItemDetail.class);

                            Toast.makeText(GroupByCategoryProductSearchMainActivity.this, "Row pressed", 1000);
                            startActivity(intent_show_detail);
                            finish();
                        }
                    });

               table_row.addView(row_layout);
               line_layout.addView(img_line);
               tl_group_product_list_by_category.addView(table_row);
               tl_group_product_list_by_category.addView(line_layout);
//          }

            Log.v("-->","GroupByCategoryProductSearchMainActivity ENDING createSingleRow()");
            single_row_id++;
        }

Problem in :

class MyGroupByCategorySync extends AsyncTask 
    {
        String bycategory_info[] = new String[9];
        Drawable product_image = null;
        int no_of_rows = list_productname.size();


    @Override
    protected Object doInBackground(Object... params)
    {

        Log.i("--: doInBackground :-- ", "no_of_rows = "+no_of_rows);
        for(int i=0;i<no_of_rows;i++)
        {
            bycategory_info[0] = list_productid.get(i).toString();
            bycategory_info[1] = list_productname.get(i).toString();
            bycategory_info[2] = list_offername.get(i).toString();
            bycategory_info[3] = list_offerid.get(i).toString();
            bycategory_info[4] = list_location.get(i).toString();
            bycategory_info[5] = list_price.get(i).toString();
            bycategory_info[6] = list_prdescription.get(i).toString();
            bycategory_info[7] = list_catname.get(i).toString();
            bycategory_info[8] = list_categoryid.get(i).toString();




            product_image = loadImageFromWebOperations(list_thumbnail.get(i).toString());
            XMLData.group_by_category_product_image_list.add(product_image);

            if(!is_searched)
              XMLData.initial_list_of_product_by_category.add(new ByCategory(bycategory_info[0],bycategory_info[1],list_thumbnail.get(i).toString(),bycategory_info[2],bycategory_info[3],bycategory_info[4],bycategory_info[5],bycategory_info[6],bycategory_info[7],bycategory_info[8], product_image));
            else
              XMLData.searched_list_of_product_by_category.add(new ByCategory(bycategory_info[0],bycategory_info[1],list_thumbnail.get(i).toString(),bycategory_info[2],bycategory_info[3],bycategory_info[4],bycategory_info[5],bycategory_info[6],bycategory_info[7],bycategory_info[8], product_image));
              publishProgress();
            SystemClock.sleep(15);
        }

        Log.v("-->","ENDING doInBackground()");
        XMLData.is_by_category_product_data_parsed = true;
        return null;
    }
    @Override
    protected void onPostExecute(Object result) 
    {
        super.onPostExecute(result);
        pressed_once = false;
        single_row_id = 0;
        Log.i("--: VALUE AFTER onPostExecute:--","pressed_once = "+pressed_once);
    }
    @Override
    protected void onProgressUpdate(Object... values) 
    {

        createSingleRow(bycategory_info, product_image);
    }
}
  • 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-23T05:57:08+00:00Added an answer on May 23, 2026 at 5:57 am

    You have written int no_of_rows = list_productname.size(). Does all the arraylist have size greater than or equal to that of list_productname means if any arraylist have lesser size than list_productname then that will cause ArrayIndexOutOfBoundsExcption.
    because you are looping to get data from several arraylist until you reach list_productname size which is wrong. other array list which suffers because of this logic are list_productid, list_offername, list_offerid etc. You are asuming that other arraylist have minimum no_of_rows number of data.

    Thanks
    Deepak

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

Sidebar

Related Questions

12-27 16:57:11.711: E/AndroidRuntime(22081): Caused by: java.lang.ClassCastException: com.mygps.android.AlarmReceiver. This is one of my error in
I am getting error ERROR/AndroidRuntime(1482): java.lang.NullPointerException from my ImageAdapter class.Please Help me to solve
I'm trying to solve a segmentation fault. This message appears in my apache-error.log: [notice]
I get this error message as I execute my JUnit tests: java.lang.OutOfMemoryError: GC overhead
I get this error: java.lang.InternalError: name is too long to represent at java.lang.ClassLoader.defineClass1(Native Method)
I'm getting this error: Initial SessionFactory creation failed.java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory Is this error is cause
While running the application I'm getting these errors 10-09 10:20:57.138: ERROR/AndroidRuntime(282): java.lang.RuntimeException: Unable to
How can i solve this error:Column 'ASSET' does not belong to table . ?
This query gives me syntax error in when-between line. how can i solve them?
I'm trying to solve this flickering problem on the iphone (open gl es game).

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.