昨天纠结了很久的问题,一直找不到原因,早上发现是一个低级错误:
1 private void selectButton(int id) { 2 switch (id) { 3 case 0: 4 recommend_button.setEnabled(false); 5 recommend_button.performClick(); 6 break; 7 case 1: 8 hotspot_button.setEnabled(false); 9 hotspot_button.performClick(); 10 break; 11 case 2: 12 tieba_button.setEnabled(false); 13 tieba_button.performClick(); 14 break; 15 case 3: 16 bottom_tv.setEnabled(false); 17 bottom_tv.performClick(); 18 break; 19 case 4: 20 bottom_social_friends.setEnabled(false); 21 bottom_social_friends.performClick(); 22 break; 23 case 5: 24 25 if(isFromWaterFallActivity){ 26 bottom_publish.setEnabled(false); 27 bottom_publish.performClick(); 28 isFromWaterFallActivity = false; 29 }else{ 30 recommend_button.setEnabled(false); 31 recommend_button.performClick(); 32 isFromWaterFallActivity = true; 33 } 34 break; 35 default: 36 break; 37 }
由于switch 中间的某几个 case 忘记加上 break;引发的问题,在此明示!