1Determine the enum value represented by the int value and then switch on the enum value.
2
3enum GuideView {
4 SEVEN_DAY,
5 NOW_SHOWING,
6 ALL_TIMESLOTS
7}
8
9// Working on the assumption that your int value is
10// the ordinal value of the items in your enum
11public void onClick(DialogInterface dialog, int which) {
12 // do your own bounds checking
13 GuideView whichView = GuideView.values()[which];
14 switch (whichView) {
15 case SEVEN_DAY:
16 ...
17 break;
18 case NOW_SHOWING:
19 ...
20 break;
21 }
22}
1private enum FooNum {
2 //Options for your enum
3 A,
4 B
5 }
6
7public void foo(FooNum fooNum){
8
9switch(fooNum){
10 case A:
11 //you selected A
12 break;
13 case B:
14 //you selected B
15 break;
16 default:
17 //do some stuff
18 break;
19 }
20}
21