Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/211.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Android如何存储具有共享首选项的大整数?_Java_Android_Sharedpreferences_Biginteger - Fatal编程技术网

Java Android如何存储具有共享首选项的大整数?

Java Android如何存储具有共享首选项的大整数?,java,android,sharedpreferences,biginteger,Java,Android,Sharedpreferences,Biginteger,正如标题所说:如何在android中存储具有共享首选项的大整数 您可以使用以下选项: public static void loadI() { i = new BigInteger(prefs.getString("I", "0")); } public static void saveI() { SharedPreferences.Editor editor = prefs.edit(); editor.putString("I", i.toString());

正如标题所说:如何在android中存储具有共享首选项的大整数


您可以使用以下选项:

public static void loadI() {
    i = new BigInteger(prefs.getString("I", "0"));
}

public static void saveI() {
    SharedPreferences.Editor editor = prefs.edit();
    editor.putString("I", i.toString());
    editor.apply();
}

大整数
转换为
字符串
public static void loadI() {
    i = new BigInteger(prefs.getString("I", "0"));
}

public static void saveI() {
    SharedPreferences.Editor editor = prefs.edit();
    editor.putString("I", i.toString());
    editor.apply();
}