I have a code that needs to be shortened, and I was recommended on Reddit.com that I use functions for this. But the problem is that the code is basically a collection of public static final"links" such as PIXELS_PER_INCH = 72.
I open my application on GitHub if someone wants to look at it that way.
Here's an example of where I assign values to my constants:
public static final int PICTURES_4 = 0;
public static final int PICTURES_6 = 1;
public static final int PICTURES_8 = 2;
public static final int PICTURES_10 = 3;
public static final int PICTURES_12 = 4;
public static final int PICTURES_OPTION_0 = 4;
public static final int PICTURES_OPTION_1 = 6;
public static final int PICTURES_OPTION_2 = 8;
public static final int PICTURES_OPTION_3 = 10;
And here is an example of where I use these constant links:
switch (settings.getInt(SettingsActivity.PICTURES_OPTION, SettingsActivity.DEFAULT_PICTURES_OPTION)) {
case SettingsActivity.PICTURES_4:
totalImages = SettingsActivity.PICTURES_OPTION_0;
break;
case SettingsActivity.PICTURES_6:
totalImages = SettingsActivity.PICTURES_OPTION_1;
break;
case SettingsActivity.PICTURES_8:
totalImages = SettingsActivity.PICTURES_OPTION_2;
break;
, , , . ? - (, PIXELS_PER_INCH = 72) .
.
:
aioobe Lloyd Ozymandias Force. EnumMap for. for myEnumMap.values() - . Googled it , myEnumMap.class.getEnumConstants(), .