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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:05:46+00:00 2026-05-29T11:05:46+00:00

I am fetching data from cursor. Using this cursor i am populating the text

  • 0

I am fetching data from cursor. Using this cursor i am populating the text for my radio button. While displaying the activity it works fine but when i try to select the radio button, i again try to access my cursor and at that time i get the cursor out of bounds exception. Please help me out.

Cursor cur=db.getForcemodLevelForMenuitem(mnuItmID);            
   cur.moveToFirst();
   while (cur.isAfterLast() == false) {
     cnt=1;
     //Level 1
     if(cur.getInt(0)==1)
      {
       LinearLayout level1Layout=(LinearLayout)findViewById(R.id.level1Layout);
       level1Layout.setVisibility(View.VISIBLE);

   //ArrayList menuitemForcemodMapsLevel1=db.GetBaseObjectListFromDBWhere("MenuitemForcemodMapping", "MenuitemID= "+mnuItmID+ " and Level="+1);                    
        menuitemForcemodMapsLevel1=db.getForcemodDetailsForMenuitem(mnuItmID,1);
        RadioGroup level1_rg=(RadioGroup) findViewById(R.id.level1_rg);
        RadioButton[] rblevel1=new RadioButton[menuitemForcemodMapsLevel1.getCount()];

        menuitemForcemodMapsLevel1.moveToFirst();                   
            int i=0;
            while (menuitemForcemodMapsLevel1.isAfterLast() == false) { 

            rblevel1[i] =new RadioButton(AddPopupMenuItem.this);
            rblevel1[i].setText(menuitemForcemodMapsLevel1.getString(1).substring(0));              
            rblevel1[i].setTextColor(R.color.black);                        
            level1_rg.addView(rblevel1[i]);
            rblevel1[i].setOnClickListener(new OnClickListener() {                     

              @Override
                  public void onClick(View v) {
                 // TODO Auto-generated method stub 
                  menuitemForcemodMapsLevel1.moveToPosition(i);
                  forceModNameList.add(menuitemForcemodMapsLevel1.getString(1).substring(0));
                           }
                        });
                           i++;
                           menuitemForcemodMapsLevel1.moveToNext();
                           }                    
                           menuitemForcemodMapsLevel1.close();
                           rblevel1=null;
                         }
                       }
                        cur.moveToNext();
                      }
                     cur.close();
                     db.close();
                   } 
                 }

I am getting error at this line

 :forceModNameList.add(menuitemForcemodMapsLevel1.getString(1).substring(0));

Thanks ,
Neha

  • 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-29T11:05:47+00:00Added an answer on May 29, 2026 at 11:05 am

    You already retreive the 1st element at :

    rblevel1[i].setText(menuitemForcemodMapsLevel1.getString(1).substring(0));

    so the cursor is moved ahead. And then you are asking again the same thing to retrieve. Cursor can’t move backwards, it moves only forward by default. So you are getting this error.

    Why don’t you save the value in a String and can thus use again without the need of retreiving it again.

    I beleive this will simplify your code and also solve the problem. Try out.

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

Sidebar

Related Questions

I'm fetching some data from an MSSQL table using the mssql_fetch_object, but the text
If I am fetching data from a MySQL database and using a while loop
i am fetching data from a table using mysql_fetch_aaray the data is displaying correctly
I have an App using UITableViews and fetching data from a server. I am
I'm fetching data from a text file or log periodically and it gets inserted
i am using ADO.Net oledb for inserting and fetching data from Excel database. I
I'm currently fetching data from a MySQL database using JDBC and executeQuery . One
hello please help me out regarding this query ,I am fetching data from different
I am fetching data from the server in a big quantity. I am using
i am having problems while fetching data from kml file. geoXml.parse(http://localhost/maps/phpmysqlajax_genkml.kml); error in console

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.