Method to get int from preference
int value of desired preference
preference's name
preference's value when the value is null