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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:08:36+00:00 2026-06-18T03:08:36+00:00

Im new to android.. Im facing a problem in Nextbutton while displaying the next

  • 0

Im new to android..

Im facing a problem in Nextbutton while displaying the next question…

In my first time set text im getting the correct question and matched four option answers. What i needed is..

I have a nextbutton for displaying the next question and answers..When click on next button i can get the next four options for next question..But i can’t get next question after four times i click on next it shows next question…but answers are correct.

What im doing wrong? what im missing?

Any help would be appreciated…Thanks a lot in advance..

      protected String doInBackground(String... args) {
    List<NameValuePair> params = new ArrayList<NameValuePair>();
        System.out.println("cool");
    params.add(new BasicNameValuePair("tid", tid));
    json = jsonParser.makeHttpRequest(url_get_quesurl, "GET", params);
    System.out.println("ques value got");
    Log.d("All Groups: ", json.toString());
        System.out.println("question");
    try {
    int success = json.getInt(TAG_SUCCESS);
    System.out.println("Success");
    if (success == 1) {
    System.out.println("Success");
    groups = json.getJSONArray(TAG_GROUP);
    System.out.println("Result Success+++"+groups);
    for (int i = 0; i < groups.length();i++) {
    JSONObject c = groups.getJSONObject(i);
          String question = c.getString(TAG_QUES);
      System.out.println("Checking ::"+question);
    ques1.add(question);
    String answer = c.getString(TAG_ANSW);
    System.out.println("Checking ::"+answer);
    answ1.add(answer);
           }
        } else {
            showAlert();
        }
    } catch (JSONException e) {
        System.out.println("Error "+e.toString());
    }
    return null;
}  
   protected void onPostExecute(String file_url) {
    pDialog.dismiss();
      ques1=new ArrayList<String>(new ArrayList<String>(ques1));
            //  j=0;
            TextView txtque = (TextView) findViewById(R.id.que_txt); 
            txtque.setText(ques1.get(j));
    answ1=new ArrayList<String>(new ArrayList<String>(answ1));
            btn_practice1.setText(answ1.get(0));
            btn_practice2.setText(answ1.get(1));
            btn_practice3.setText(answ1.get(2));
            btn_practice4.setText(answ1.get(3));
         btn_practicerg.setOnCheckedChangeListener(new OnCheckedChangeListener() {
                @Override
                public void onCheckedChanged(RadioGroup group, int checkedId) { 
                    RadioButton radioButton = (RadioButton) findViewById(checkedId);
                   // Toast.makeText(Question.this, "" + radioButton.getText(), 2000).show(); 
                    TextView txtRadio = (TextView) findViewById(R.id.rdtxt); 
                    txtRadio.setText("" + radioButton.getText());
                }
    });
        Button nextBtn = (Button) findViewById(R.id.nxt_btn);
        nextBtn.setOnClickListener(new Button.OnClickListener(){
          public void onClick(View v){  
          j++;
        TextView txtque = (TextView) findViewById(R.id.que_txt); 
        txtque.setText(ques1.get(j)); 
        k++;
        btn_practice1.setText(answ1.get((k*4)+0));
        btn_practice2.setText(answ1.get((k*4)+1));
        btn_practice3.setText(answ1.get((k*4)+2));
        btn_practice4.setText(answ1.get((k*4)+3));
         }
       });
}
  • 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-18T03:08:37+00:00Added an answer on June 18, 2026 at 3:08 am

    The problem is you are storing answers in answ1 array for that time four empty strings adding in ques1 array so you are getting your next question after four times pressing the button….

    For that maintain two indexes one for questions and other for answers..

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

Sidebar

Related Questions

Im new to android.. Im facing a problem in Nextbutton while displaying the next
I am new to Android development and facing a problem while using AndEngine. I
im new to android gaming and started andengine and facing problem while using createTiledFromAsset
I am first time asking question,please solve my problem. I am developing small Music
I am new to Android development and am facing a slight issue. My first
I'm new to Android. I am facing problem with array list.The problem is, My
Im new to android.. Im facing problem with intent.. My problem is...I want pass
I am new in android development. Currently, I facing problem to choose a proper
Hi iam new in Android and I am facing a problem in creating new
hello geeks as i'm new to android i'm facing a critical problem as i

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.