【问题标题】:Android How to store a big integer with shared preferences?Android 如何存储具有共享偏好的大整数?
【发布时间】:2016-09-09 22:36:49
【问题描述】:

正如标题所说:如何在android中存储一个具有共享偏好的大整数?

Big integer i;
public static void loadI() {
    cash = prefs.get...?("", i);
}

public static void saveI() {
    editor.put...?("", i);

}

【问题讨论】:

  • BigInteger 转换为String

标签: java android sharedpreferences biginteger


【解决方案1】:

您可以使用以下内容:

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();
}

【讨论】:

    猜你喜欢
    • 2012-05-01
    • 1970-01-01
    • 2017-09-27
    • 2011-09-13
    • 1970-01-01
    • 1970-01-01
    • 2014-12-31
    • 2014-12-17
    • 2017-05-17
    相关资源
    最近更新 更多