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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:20:58+00:00 2026-06-18T00:20:58+00:00

Hi I’m trying to create an app for Android and in order to develop

  • 0

Hi I’m trying to create an app for Android and in order to develop it i need to navigate through different pages and questions. For this task I have defined a radiogroup with some radiobuttons. What I want to obtain is each question answered radiobutton and when the user goes thorugh differentes pages the value can be retrieved. I have tried this code that consists of that if there is one selected radiobutton, there arent created new radiobuttons (radiobuttons checked false). However with this code, there is always a selected answer so there is always the same radiobutton selected. I will appreciate some help.

        radBotA.setOnCheckedChangeListener(radioCheckChangeListener);
            radBotB.setOnCheckedChangeListener(radioCheckChangeListener);
            radBotC.setOnCheckedChangeListener(radioCheckChangeListener);
            radBotD.setOnCheckedChangeListener(radioCheckChangeListener);
            radBotA.setOnClickListener(radioClickListener);
            radBotB.setOnClickListener(radioClickListener);
            radBotC.setOnClickListener(radioClickListener);
            radBotD.setOnClickListener(radioClickListener);
            if (radBotA.isChecked()){
                Answers[position]="A";
                }
            else if(radBotB.isChecked()){
           Answers[position]="B"; }            
            else if(radBotB.isChecked()){
                   Answers[position]="C"; } 
            else if(radBotC.isChecked()){
                   Answers[position]="D"; }     
            else if(radBotD.isChecked()){
                   Answers[position]="D"; } 
            else {
                radBotA.setChecked(false);
                radBotA.setChecked(false);
                radBotA.setChecked(false);
                radBotA.setChecked(false);
            }

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

                position = position -1; 
                questions.Previous();
                currentQuestion();







            }
        });
        bNext.setOnClickListener(new View.OnClickListener(){
            @Override

                public void onClick(View v) {
                position = position +1;
                questions.Next();       
                currentQuestion();





            }
        });

    private void currentQuestion() {
            if (position==0){
                bPrevious.setVisibility(View.GONE);
            }else{
                    bPrevious.setVisibility(View.VISIBLE);
                }
            if (position==nPreguntas-1){
                bNext.setVisibility(View.GONE);
            }else{
                bNext.setVisibility(View.VISIBLE);
            } 
            questions.currentQuestion(this, category);
            enunciado.setImageResource(Enunciado[position]);
            pregunta.setText(questions.getPregunta());
            final RadioButton radBotA = new RadioButton(this);
            final RadioButton radBotB = new RadioButton(this);
            final RadioButton radBotC = new RadioButton(this);
            final RadioButton radBotD = new RadioButton(this);

            radBotA.setText("A. " + questions.getRespuestaA());
            radBotB.setText("B. " + questions.getRespuestaB());
            radBotC.setText("C. " + questions.getRespuestaC());
            radBotD.setText("D. " + questions.getRespuestaD());
            String nprueba = "Item " +  questions.getId() + " de "+ nPreguntas;


            NombrePrueba.setText(nprueba);
            if (radBotA.isChecked()){
                Answers[position]="A";
                }
            else if(radBotB.isChecked()){
           Answers[position]="B"; }            
            else if(radBotB.isChecked()){
                   Answers[position]="C"; } 
            else if(radBotC.isChecked()){
                   Answers[position]="D"; }     
            else if(radBotD.isChecked()){
                   Answers[position]="D"; } 
            else {
                radBotA.setChecked(false);
                radBotA.setChecked(false);
                radBotA.setChecked(false);
                radBotA.setChecked(false);
            }
        }

thank you all for your time

Edit:

public void save(){
            SharedPreferences settings = getSharedPreferences("Answers", 0); 
              SharedPreferences.Editor e = settings.edit();


            e.putBoolean("A0",radBotA.isChecked());
            e.putBoolean("B0",radBotB.isChecked());
            e.putBoolean("C0",radBotC.isChecked());
            e.putBoolean("D0",radBotD.isChecked());
            e.putBoolean("A1",radBotA.isChecked());
            e.putBoolean("B1",radBotB.isChecked());
            e.putBoolean("C1",radBotC.isChecked());
            e.putBoolean("D1",radBotD.isChecked());
            e.putBoolean("A2",radBotA.isChecked());
            e.putBoolean("B2",radBotB.isChecked());
            e.putBoolean("C2",radBotC.isChecked());
            e.putBoolean("D2",radBotD.isChecked());
            e.putBoolean("A3",radBotA.isChecked());
            e.putBoolean("B3",radBotB.isChecked());
            e.putBoolean("C3",radBotC.isChecked());
            e.putBoolean("D3",radBotD.isChecked());
public void load(){
            SharedPreferences settings = getSharedPreferences("Answers", 0);
              boolean answerA0 = settings.getBoolean("A0", false); 
              boolean answerB0 = settings.getBoolean("B0", false);
              boolean answerC0 = settings.getBoolean("C0", false);
              boolean answerD0 = settings.getBoolean("D0", false);
              boolean answerA1 = settings.getBoolean("A1", false); 
              boolean answerB1 = settings.getBoolean("B1", false);
              boolean answerC1 = settings.getBoolean("C1", false);
              boolean answerD1 = settings.getBoolean("D1", false);
              boolean answerA2 = settings.getBoolean("A2", false); 
              boolean answerB2 = settings.getBoolean("B2", false);
              boolean answerC2 = settings.getBoolean("C2", false);
              boolean answerD2 = settings.getBoolean("D2", false);
              boolean answerA3 = settings.getBoolean("A3", false); 
              boolean answerB3 = settings.getBoolean("B3", false);
              boolean answerC3 = settings.getBoolean("C3", false);
              boolean answerD3 = settings.getBoolean("D3", false);

However I don’t know how to continue. I v’ thinking about the following code but it gives me error and where posicion is the “Page Number”:

public void Test(){
        switch(posicion){
            case(0):
                if(answerA0==true){
                    e.putBoolean("A0",radBotA.isChecked());
                }
            }
        }
    }
  • 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-18T00:21:00+00:00Added an answer on June 18, 2026 at 12:21 am

    If I understand you correctly, you want to retrieve some data in other activities. In that case the easiest way would be to use SharedPreferences.

    After user answers the question (CheckBox‘s check state is being changed) you should store your information in SharedPreferences like this:

      SharedPreferences settings = getSharedPreferences("Answers", 0); // first argument is just a name of your SharedPreferences which you want to use. It's up to you how you will name it, but you have to use the same name later when you want to retrieve data.
      SharedPreferences.Editor editor = settings.edit();
      editor.putBoolean("questionA", radBotA.isChecked()); // first argument is a name of a data that you will later use to retrieve it and the second argument is a value that will be stored
      editor.putBoolean("questionB", radBotB.isChecked());
      editor.putBoolean("questionC", radBotC.isChecked());
      editor.putBoolean("questionD", radBotD.isChecked());
    
      editor.commit(); // Commit the changes
    

    So now you have those information stored in your internal storage. In other activity, you can retrieve this information:

      SharedPreferences settings = getSharedPreferences("Answers", 0);
      boolean answerA = settings.getBoolean("questionA", false); // The second argument is a default value, if value with name "questionA" will not be found
      boolean answerB = settings.getBoolean("questionB", false);
      boolean answerC = settings.getBoolean("questionC", false);
      boolean answerD = settings.getBoolean("questionD", false);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to create an if statement in PHP that prevents a single post
I am trying to loop through a bunch of documents I have to put
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to understand how to use SyndicationItem to display feed which is
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
link Im having trouble converting the html entites into html characters, (&# 8217;) 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.