(Android) Add getFloat/setFloat to ConfigFile.java
This commit is contained in:
parent
b6539dc879
commit
23faaba1f1
|
@ -80,6 +80,10 @@ public class ConfigFile {
|
||||||
public void setDouble(String key, double value) {
|
public void setDouble(String key, double value) {
|
||||||
map.put(key, Double.toString(value));
|
map.put(key, Double.toString(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setFloat(String key, float value) {
|
||||||
|
map.put(key, Float.toString(value));
|
||||||
|
}
|
||||||
|
|
||||||
public boolean keyExists(String key) {
|
public boolean keyExists(String key) {
|
||||||
return map.containsKey(key);
|
return map.containsKey(key);
|
||||||
|
@ -108,6 +112,14 @@ public class ConfigFile {
|
||||||
else
|
else
|
||||||
throw new NumberFormatException();
|
throw new NumberFormatException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float getFloat(String key) throws NumberFormatException {
|
||||||
|
String str = getString(key);
|
||||||
|
if (str != null)
|
||||||
|
return Float.parseFloat(str);
|
||||||
|
else
|
||||||
|
throw new NumberFormatException();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean getBoolean(String key) {
|
public boolean getBoolean(String key) {
|
||||||
String str = getString(key);
|
String str = getString(key);
|
||||||
|
|
Loading…
Reference in New Issue