public void put ( String key , Object value ) { if ( value . getClass ( ) . equals ( String . class ) ) { putString ( key , value . toString ( ) ) ; } else if ( value . getClass ( ) . equals ( Integer . class ) ) { putInt ( key , ( Integer ) value ) ; } else if ( value . getClass ( ) . equals ( Float . class ) ) { putFloat ( key , ( Float ) value ) ; } else if ( value . getClass ( ) . equals ( Long . class ) ) { putLong ( key , ( Long ) value ) ; } else if ( value . getClass ( ) . equals ( Boolean . class ) ) { putBoolean ( key , ( Boolean ) value ) ; } else { putString ( key , value . toString ( ) ) ; } }
Put the value in given shared preference