I have my settings.java and my fragment.java.
In the fragment (that exists in my settings.java) I have a randomized number to set a view. Which works perfectly. I'm trying to change it from a random int to something pulled out of shared prefs. In my settings.java I have a method:
public int getHour() {
SharedPreferences settings = getSharedPreferences("My_Prefs",
MODE_PRIVATE);
int timeout = settings.getInt("timeout_hour", 8);
return timeout;
}
and I call this in my fragment.java by saying
...settings.getHour();
But this causes it to crash. If I simply replace it with a random int (any int) ...8
the program runs perfectly. Why does my app run when I just have the number 8, but when getHour()
returns a number (8 in this case) it fails. Is this some kind of limitation with fragments?