I want to use existing array element as switch case rather giving constant string value to switch case
I have values in resource string array that I used to display, and user has to select from these display values, now I want to compare the input value that I saved in shared preference and the values that I have in array resource, I wrote something like this but it didn't work
private static String activity;
private static int result;
activity = SharedPrefUtils.getActivityLevel(context);
String[] activities 
= context.getResources().getStringArray(R.array.activity);
switch (activity){
      //something like getting values from array
        case activities[0]:
            result = 0;
            break;
        case activities[1]:
            result = 200;
            break;
        case activities[2]:
            result = 300;
            break;
    }
    return result;
 
     
    