I'm developing an android app on eclipse, when I try some code like
Cannot switch on a value of type String for source level below 1.7. Only convertible int values or enum variables are permitted
Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project Properties.
switch statement on
String objects is a new feature introduced in Java 1.7. Unfortunatelly Android requires version 1.6 or 1.5. This is why you have to forget for some time about such constructions.
You can avoid using if-statements-chain by storing the map of methods which will be executed for certain
Map<String, Method>. You can always encapsulate
Method it with some
Handler object. Look here for more info: How to remove large if-else-if chain