Update Sharedpreferences.java

Replaced if else with switch case due to issue #9