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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:12:32+00:00 2026-06-15T00:12:32+00:00

I am working on quiz app of which user can select 4 types of

  • 0

I am working on quiz app of which user can select 4 types of question difficulties. The questions and answers are stored in string.xml as string arrays.

If all the checkboxes are ticked, the respective string arrays would be stored to ArrayList NUM_ALL_QuestionNames for later quiz retrieval as the questions inside will be further mixed and shuffled.

Full coding as follows:

public class Num_index extends Activity 
{
       String[] NUM_SIM_QuestionNames;
       String[] NUM_MED_QuestionNames;
       String[] NUM_DIF_QuestionNames;
       String[] NUM_EXP_QuestionNames;
       String[] NUM_SIM_AnswerNames;
       String[] NUM_MED_AnswerNames;
       String[] NUM_DIF_AnswerNames;
       String[] NUM_EXP_AnswerNames;

       private List<String> NUM_ALL_QuestionNames;  // for quiz
       private List<String> NUM_ALL_AnswerNames;    // for quiz

       private int QuestionImport;         
       private TextView CheckTextView; 
       private TextView AlertTextView;     

       @Override
       public void onCreate(Bundle savedInstanceState) 
       {
          super.onCreate(savedInstanceState); 
          setContentView(R.layout.main_num_index); 

          Button ButtonStart= (Button) findViewById(R.id.buttonStart);
          ButtonStart.setOnClickListener(startButtonListener);


          CheckTextView = (TextView) findViewById(R.id.checktextView); 
          AlertTextView = (TextView) findViewById(R.id.alerttextView);            
          AlertTextView.setText("Start: No alert");

          NUM_SIM_QuestionNames = getResources().getStringArray(R.array.Num_Q_Simple_List);
          NUM_MED_QuestionNames = getResources().getStringArray(R.array.Num_Q_Medium_List);
          NUM_DIF_QuestionNames = getResources().getStringArray(R.array.Num_Q_Diff_List);
          NUM_EXP_QuestionNames = getResources().getStringArray(R.array.Num_Q_Expert_List);           
          NUM_SIM_AnswerNames = getResources().getStringArray(R.array.Num_A_Simple_List);
          NUM_MED_AnswerNames = getResources().getStringArray(R.array.Num_A_Medium_List);
          NUM_DIF_AnswerNames = getResources().getStringArray(R.array.Num_A_Diff_List);
          NUM_EXP_AnswerNames = getResources().getStringArray(R.array.Num_A_Expert_List);

          NUM_ALL_QuestionNames = new ArrayList<String>();
          NUM_ALL_AnswerNames = new ArrayList<String>();
          NUM_ALL_QuestionNames.clear();
          NUM_ALL_AnswerNames.clear();                                
       };

       private OnClickListener startButtonListener = new OnClickListener() 
       {
          @Override
          public void onClick(View v) 
          {
              CheckBox CheckSim = (CheckBox) findViewById(R.id.checkBox2);
              CheckBox CheckMed = (CheckBox) findViewById(R.id.checkBox3);
              CheckBox CheckDif = (CheckBox) findViewById(R.id.checkBox4);
              CheckBox CheckExp = (CheckBox) findViewById(R.id.checkBox5);    

              if (CheckSim.isChecked()) 
              {
                  QuestionImport= 0;                  
                  QuestionImport = NUM_SIM_QuestionNames.length;
                  int i =0;
                  while (i<QuestionImport)
                  {
                      String Q_toimport = NUM_SIM_QuestionNames[i];
                      String A_toimport = NUM_SIM_AnswerNames[i];                                                       

                      NUM_ALL_QuestionNames.add(Q_toimport);
                      NUM_ALL_AnswerNames.add(A_toimport);                    
                      ++i;                    
                  }           
              };    

// same for other checkbox, not shown here for simplicity //   


              if ((!CheckSim.isChecked()) && (!CheckMed.isChecked()) && (!CheckDif.isChecked()) && (!CheckExp.isChecked()))  
              {
                  int k = 0;
                  if (NUM_ALL_QuestionNames.size() >0) {k= NUM_ALL_QuestionNames.size();}
                  CheckTextView.setText(k);
                  AlertTextView.setText("Please select at least one choice!");
              }

              if ((CheckSim.isChecked()) || (CheckMed.isChecked()) || (CheckDif.isChecked()) || (CheckExp.isChecked()))  
              {
                  int k = 0;
                  if (NUM_ALL_QuestionNames.size() >0) {k= NUM_ALL_QuestionNames.size();}
                  CheckTextView.setText(k);
                  AlertTextView.setText("Have Selection!");
              }                           
          } 
       }; 

Logcat:

11-17 21:55:41.510: E/AndroidRuntime(12639): FATAL EXCEPTION: main
11-17 21:55:41.510: E/AndroidRuntime(12639): android.content.res.Resources$NotFoundException: String resource ID #0x0
11-17 21:55:41.510: E/AndroidRuntime(12639):    at android.content.res.Resources.getText(Resources.java:260)
11-17 21:55:41.510: E/AndroidRuntime(12639):    at android.widget.TextView.setText(TextView.java:3680)
11-17 21:55:41.510: E/AndroidRuntime(12639):    at com.pearappx.iq_3.Num_index$1.onClick(Num_index.java:188)
11-17 21:55:41.510: E/AndroidRuntime(12639):    at android.view.View.performClick(View.java:3627)
11-17 21:55:41.510: E/AndroidRuntime(12639):    at android.view.View$PerformClick.run(View.java:14329)
11-17 21:55:41.510: E/AndroidRuntime(12639):    at android.os.Handler.handleCallback(Handler.java:605)
11-17 21:55:41.510: E/AndroidRuntime(12639):    at android.os.Handler.dispatchMessage(Handler.java:92)
11-17 21:55:41.510: E/AndroidRuntime(12639):    at android.os.Looper.loop(Looper.java:137)
11-17 21:55:41.510: E/AndroidRuntime(12639):    at android.app.ActivityThread.main(ActivityThread.java:4511)
11-17 21:55:41.510: E/AndroidRuntime(12639):    at java.lang.reflect.Method.invokeNative(Native Method)
11-17 21:55:41.510: E/AndroidRuntime(12639):    at java.lang.reflect.Method.invoke(Method.java:511)
11-17 21:55:41.510: E/AndroidRuntime(12639):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
11-17 21:55:41.510: E/AndroidRuntime(12639):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
11-17 21:55:41.510: E/AndroidRuntime(12639):    at dalvik.system.NativeStart.main(Native Method)

Question:

When executing the app, error occurs at line 188, which is the line for
CheckTextView.setText(k);

I would just like to see whether the NUM_ALL_QuestionNames has imported all the strings, i.e. if each of the arrays has 8 values, the CheckTextView will show 32 if all the 4 levels are ticked, and showing 24 if 3 are ticked and so on.

However to solve for the line 188 problem? Many thanks!!

  • 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-15T00:12:33+00:00Added an answer on June 15, 2026 at 12:12 am

    I was getting this error too when trying to pass an int to the `setText()’ function.

    Try converting k to a String before passing it to setText()

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

Sidebar

Related Questions

I am working on quiz application . For each question there are multiple answers
I'm working on a java quiz application. The application will consist of 20 questions
I have little quiz game I've working on and am tracking correct answers. I
Newbie error? Im working on a quiz app that uses answer results from a
I'm working on a little quiz app, and I was working on an algorithm
I am working on quiz application. It contains 2 types of tests. The first
I have an app which posts a message like this to a user's Facebook
In my multiple choice Quiz show project on google app engine multiple users can
I am working on a quiz application. In that I am displaying the question
I am working on php quiz-test script. I need to know which selected and

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.