@Test public void testEmptyKeyInPreferences() { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); prefs.edit().putString(OpenWeatherMapApiKey.PREFERENCE_KEY, "").commit(); OpenWeatherMapApiKey key = new OpenWeatherMapApiKey(context); assertTrue(key.getKey().startsWith("4aba43")); prefs.edit().remove(OpenWeatherMapApiKey.PREFERENCE_KEY).commit(); }
public String getKey() { String key = getKeyFromPreferences(); if (key == null) { key = getKeyFromResources(); } if (key == null) { key = getDefaultKey(); } return key; }
OpenWeatherMapApiKey { public String getKey() { String key = getKeyFromPreferences(); if (key == null) { key = getKeyFromResources(); } if (key == null) { key = getDefaultKey(); } return key; } }
OpenWeatherMapApiKey { public String getKey() { String key = getKeyFromPreferences(); if (key == null) { key = getKeyFromResources(); } if (key == null) { key = getDefaultKey(); } return key; } OpenWeatherMapApiKey(Context context); }
OpenWeatherMapApiKey { public String getKey() { String key = getKeyFromPreferences(); if (key == null) { key = getKeyFromResources(); } if (key == null) { key = getDefaultKey(); } return key; } OpenWeatherMapApiKey(Context context); String getKey(); }
OpenWeatherMapApiKey { public String getKey() { String key = getKeyFromPreferences(); if (key == null) { key = getKeyFromResources(); } if (key == null) { key = getDefaultKey(); } return key; } OpenWeatherMapApiKey(Context context); String getKey(); static final String PREFERENCE_KEY; }