Android - SharedPreference converting to Double

后端 未结 3 937
粉色の甜心
粉色の甜心 2021-01-07 10:15

Basically i have a valued saved into shared preference as a string.

I am retrieving the value saved, and am trying to use it in a calculation.

How can i conv

3条回答
  •  星月不相逢
    2021-01-07 10:49

    How can i convert this so that it is seen as a double instead of a string?

    A) If you don't need the double precision, use floats: getFloat and putFloat.

    B) Parse the string as a double then save the double as a string again.

提交回复
热议问题