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

  • Home
  • SEARCH
  • 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 7946737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:14:16+00:00 2026-06-04T01:14:16+00:00

i have parsed data successfully using sax parser and output is coming properly in

  • 0

i have parsed data successfully using sax parser and output is coming properly in logcat but i have to arrange that data systematically. But the problem is my question length and index is 2 so options are also coming 2. instead they are 4 for each question. please suggest

code snippet is

for (int i = 0; i < categorylist.getTitle().size(); i++) {

            TableRow tr = new TableRow(this);
            tr.setPadding(2, 2, 2, 2);

            TableLayout.LayoutParams tableRowParams=
                  new TableLayout.LayoutParams
                  (TableLayout.LayoutParams.FILL_PARENT,TableLayout.LayoutParams.FILL_PARENT);

            int leftMargin=0;
            int topMargin=2;
            int rightMargin=0;
            int bottomMargin=1;

            tableRowParams.setMargins(leftMargin, topMargin, rightMargin, bottomMargin);

            tr.setLayoutParams(tableRowParams);

            name[i]= new TextView(this);
            name[i].setText(categorylist.getTitle().get(i));
            name[i].setTextColor(Color.WHITE);
            name[i].setTextSize(12);
            name[i].setPadding(10,0,0,0);
            name[i].setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
            tr.addView(name[i]);
            t1.addView(tr, tableRowParams);

            LinearLayout.LayoutParams layoutParams = new RadioGroup.LayoutParams(
                    RadioGroup.LayoutParams.WRAP_CONTENT,
                    RadioGroup.LayoutParams.WRAP_CONTENT);

            rad1[i]= new RadioButton(this);
            rad1[i].setText(categorylist.getValue().get(i));    
            rad1[i].setTextColor(Color.WHITE);
            rad1[i].setTextSize(12);
            rad1[i].setPadding(10,0,0,0);
            rad1[i].setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
            rgrp.addView(rad1[i], 0, layoutParams);

        }

and xml is

<Values>
<Question>

<Description><![CDATA[Some Question]]></Description>

                    <Options>

                        <option value="correct"><![CDATA[All of these]]></option>

                        <option value="incorrect"><![CDATA[Ok]]></option>

                        <option value="incorrect"><![CDATA[Fine]]></option>

                        <option value="incorrect"><![CDATA[Good one]]></option>





                    </Options>  

            </Question>

</Values>

logcat output is:

05-14 15:22:27.228: INFO/This is the title:(559): Which of the following are called celestial bodies?
05-14 15:22:27.248: INFO/This is the option:(559): All of these
05-14 15:22:27.248: INFO/This is the option:(559): Sun
05-14 15:22:27.248: INFO/This is the option:(559): Planets
05-14 15:22:27.248: INFO/This is the option:(559): Moon 
05-14 15:22:27.258: INFO/This is the title:(559): In our solar system, _________ planets revolve around the Sun.
05-14 15:22:27.258: INFO/This is the option:(559): eight
05-14 15:22:27.258: INFO/This is the option:(559): five
05-14 15:22:27.258: INFO/This is the option:(559): ten
05-14 15:22:27.258: INFO/This is the option:(559): nine
  • 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-04T01:14:17+00:00Added an answer on June 4, 2026 at 1:14 am

    I think You should have two loop for example

    int l;
        for (int i = 0; i < categorylist.getTitle().size(); i++){
        for(int j= 0; j < optionlist.size()/categorylist.getTitle().size(); j++){
        //add option to question
    l=l++;
    //use l;
        }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been using a SAX parser for a while now to get data
I have built one 'deep' NSMutableDictionary that contains parsed XML data along with other
I use this bit of code to feed some data i have parsed from
I have a thousands of data parsed from huge XML to be inserted into
I have a rake task that pulls and parses JSON data over an SSL
I have 2 activities. The first activity is an activity that parses JSON data
I have a universal data type, which is passed by value, but does not
I have been using json.NET successfully in projects for some time now without any
I have been successfully using boost::spirit::qi to to parse a stream consisting of the
I have an SSRS data source that I would like to test out in

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.