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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:03:09+00:00 2026-05-16T22:03:09+00:00

In my program this is one switch case but it is not executed can

  • 0

In my program this is one switch case but it is not executed can u give me the solution

                    Resources r2 = getResources();
                String[] strtemp409A=r2.getStringArray(R.array.strtemp409A);
                String[] strtemp11=r2.getStringArray(R.array.strtemp11);
                String[] strtemp113=r2.getStringArray(R.array.strtemp113);
                String[] strtemp114=r2.getStringArray(R.array.strtemp114);
                String[] strtemp12=r2.getStringArray(R.array.strtemp12);
                String[] strtemp123=r2.getStringArray(R.array.strtemp123);
                String[] strtemp124=r2.getStringArray(R.array.strtemp124);
                String[] strtemp13=r2.getStringArray(R.array.strtemp13);
                String[] strtemp134A=r2.getStringArray(R.array.strtemp134A);
                String[] strtemp22=r2.getStringArray(R.array.strtemp22);
                String[] strtemp23=r2.getStringArray(R.array.strtemp23);
                String[]strtemp401A=r2.getStringArray(R.array.strtemp401A);
                String[] strtemp401B=r2.getStringArray(R.array.strtemp401B);
                String[] strtemp402A=r2.getStringArray(R.array.strtemp402A);
                String[] strtemp402B=r2.getStringArray(R.array.strtemp402B);
                String[] strtemp403B=r2.getStringArray(R.array.strtemp403B);
                String[] strtemp404A=r2.getStringArray(R.array.strtemp404A);
                String[] strtemp407C=r2.getStringArray(R.array.strtemp407C);
                String[] strtemp408A=r2.getStringArray(R.array.strtemp408A);

                String[] strtemp410A=r2.getStringArray(R.array.strtemp410A);
                String[] strtemp414B=r2.getStringArray(R.array.strtemp414B);
                String[] strtemp416A=r2.getStringArray(R.array.strtemp416A);
                String[] strtemp417A=r2.getStringArray(R.array.strtemp417A);
                String[] strtemp500=r2.getStringArray(R.array.strtemp500);
                String[] strtemp502=r2.getStringArray(R.array.strtemp502);
                String[] strtemp503=r2.getStringArray(R.array.strtemp503);
                String[] strtemp507=r2.getStringArray(R.array.strtemp507);
                String[] strtemp508B=r2.getStringArray(R.array.strtemp508B);
                String[] strtempc409A=r2.getStringArray(R.array.strtempc409A);
                String[] strtempc410A=r2.getStringArray(R.array.strtempc410A);
                String[] strtempc414B=r2.getStringArray(R.array.strtempc414B);


    public void setRefno(int refno)
    {

        this.refno=refno;
    }
    public int getRefno()
    {
        return refno;
    }
    public void setStr(String str)
    {
        this.str=str;


    }
    public String getStr()
    {

        return str;
    }
    public double getPrs()
    {
        switch(refno)
         {
             case 0:

                 for (int i = 0; i < strtemp409A.length; i++)
                 {
                     if (str.equalsIgnoreCase(strtemp409A[i]))
                     {
                         prs = i;
                     }
                 }
                 break;
             case 1:
                 for (int i = 0; i < strtemp414B.length; i++)
                 {
                     if (str.equalsIgnoreCase(strtemp414B[i]))
                     {
                         prs = i;
                     }
                 }
                 break;
             case 2:
                 for (int i = 0; i < strtemp416A.length; i++)
                 {
                     if (str.equalsIgnoreCase(strtemp416A[i]))
                     {
                         prs = i;
                     }
                 }
                 break;
             case 3:
                 for (int i = 0; i < strtemp404A.length; i++)
                 {
                     if (str.equalsIgnoreCase(strtemp404A[i]))
                     {
                         prs = i;
                     }
                 }
                 break;
             case 4:
                 for (int i = 0; i < strtemp507.length; i++)
                 {
                     if (str.equalsIgnoreCase(strtemp507[i]))
                     {
                         prs = i;
                     }
                 }
                 break;
             case 5:
                 for (int i = 0; i < strtemp502.length; i++)
                 {
                     if (str.equalsIgnoreCase(strtemp502[i]))
                     {
                         prs = i;
                     }
                 }
                 break;
             case 6:
                 for (int i = 0; i < strtemp402A.length; i++)
                 {
                     if (str.equalsIgnoreCase(strtemp402A[i]))
                     {
                         prs = i;
                     }
                 }
                 break;
             case 7:
                 for (int i = 0; i < strtemp402B.length; i++)
                 {
                     if (str.equalsIgnoreCase(strtemp402B[i]))
                     {
                         prs = i;
                     }
                 }
                 break;
             case 8:
                 for (int i = 0; i < strtemp408A.length; i++)
                 {
                     if (str.equalsIgnoreCase(strtemp408A[i]))
                     {
                         prs = i;
                     }
                 }
                 break;
             case 9:
                 for (int i = 0; i < strtemp11.length; i++)
                 {
                     if (str.equalsIgnoreCase(strtemp11[i]))
                     {
                         prs = i;
                     }
                 }
                 break;
             case 10:
                 for (int i = 0; i < strtemp113.length; i++)
                 {
                     if (str.equalsIgnoreCase(strtemp113[i]))
                     {
                         prs = i;
                     }
                 }
                 break;
             case 11:
                 for (int i = 0; i < strtemp114.length; i++)
                 {
                     if (str.equalsIgnoreCase(strtemp114[i]))
                     {
                         prs = i;
                     }
                 }
                 break;
             case 12:
                 for (int i = 0; i <strtemp123.length; i++)
                 {
                     if (str.equalsIgnoreCase(strtemp123[i]))
                     {
                         prs = i;
                     }
                 }
                 break;
             case 13:
                 for (int i = 0; i < strtemp124.length; i++)
                 {
                     if (str.equalsIgnoreCase(strtemp124[i]))
                     {
                         prs = i;
                     }
                 }
                 break;
             case 14:
                 for (int i = 0; i < strtemp500.length; i++)
                 {
                     if (str.equalsIgnoreCase(strtemp500[i]))
                     {
                         prs = i;
                     }
                 }
                 break;
             case 15:
                 for (int i = 0; i < strtemp13.length; i++)
                 {
                     if (str.equalsIgnoreCase(strtemp13[i]))
                     {
                         prs = i;
                     }
                 }
                 break;
             case 16:
                 for (int i = 0; i < strtemp23.length; i++)
                 {
                     if (str.equalsIgnoreCase(strtemp23[i]))
                     {
                         prs = i;
                     }
                 }
                 break;
             case 17:
                 for (int i = 0; i <strtemp503.length; i++)
                 {
                     if (str.equalsIgnoreCase(strtemp503[i]))
                     {
                         prs = i;
                     }
                 }
                 break;
             case 18:
                 for (int i = 0; i < strtemp508B.length; i++)
                 {
                     if (str.equalsIgnoreCase(strtemp508B[i]))
                     {
                         prs = i;
                     }
                 }
                 break;
             case 19:
                 for (int i = 0; i < strtemp403B.length; i++)
                 {
                     if (str.equalsIgnoreCase(strtemp403B[i]))
                     {
                         prs = i;
                     }
                 }
                 break;
             case 20:
                 for (int i = 0; i <strtemp22.length; i++)
                 {
                     if (str.equalsIgnoreCase(strtemp22[i]))
                     {
                         prs = i;
                     }
                 }
                 break;
             case 21:
                 for (int i = 0; i < strtemp407C.length; i++)
                 {
                     if (str.equalsIgnoreCase(strtemp407C[i]))
                     {
                         prs = i;
                     }
                 }
                 break;
             case 22:
                 for (int i = 0; i < strtemp417A.length; i++)
                 {
                     if (str.equalsIgnoreCase(strtemp417A[i]))
                     {
                         prs = i;
                     }
                 }
                 break;
             case 23:
                 for (int i = 0; i < strtemp410A.length; i++)
                 {
                     if (str.equalsIgnoreCase(strtemp410A[i]))
                     {
                         prs = i;
                     }
                 }
                 break;
             case 24:
                 for (int i = 0; i < strtemp12.length; i++)
                 {
                     if (str.equalsIgnoreCase(strtemp12[i]))
                     {
                         prs = i;
                     }
                 }
                 break;
             case 25:
                 for (int i = 0; i < strtemp134A.length; i++)
                 {
                     if (str.equalsIgnoreCase(strtemp134A[i]))
                     {
                         prs = i;
                     }
                 }
                 break;
             case 26:
                 for (int i = 0; i <strtemp401A.length; i++)
                 {
                     if (str.equalsIgnoreCase(strtemp401A[i]))
                     {
                         prs = i;
                     }
                 }
                 break;
             case 27:
                 for (int i = 0; i < strtemp401B.length; i++)
                 {
                     if (str.equalsIgnoreCase(strtemp401B[i]))
                     {
                         prs = i;
                     }
                 }
                 break;
         }

         return prs;





    }
  • 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-16T22:03:10+00:00Added an answer on May 16, 2026 at 10:03 pm
    1. For what value of refno is it not executed? (I see there is no default case in your switch)

    2. Don’t Repeat Yourself… all that repetitive code! You will gain a lot of time if you create a “find_and_print” function, an a dispatch table that calls that function with the proper arguments.

    Here is some pseudo-code.

    void find_in_array_and_print( String[] strings, String value ) {
       for (int i = 0; i < strings.length; i++) {
         if (strings[i]==value ) {
            prs = i;
            System.out.println("prs"+prs);
            System.out.println("i"+i);
         }
       }    
    }
    
    String[] to_look_in( int refno ) {
       switch( refno ) {
         case 0: return R.array.strtemp409A;
         case 1: return R.array.strtemp414B;
         //...
       }
    }
    
    find_and_print( GetResources().getStringArray( to_look_in( refno ) ), str );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.