How to store double using SharedPrefrences?

Posted by user3924167 on Stack Overflow See other posts from Stack Overflow or by user3924167
Published on 2014-08-20T04:10:10Z Indexed on 2014/08/20 4:20 UTC
Read the original article Hit count: 143

Filed under:
|
|
|
|

I am having trouble storing a double in the phone's memory. What are my other options if this isnt possible. Basically what the code is aiming to do using sharedprefrences is take the stored value of "Alcohol" spending and then add whatever the input is in the editText to it and then store that new value for the next time. Running total of spending on alcohol

**Can someone please help with this issue and be detailed where x y & z should go in the project.

The user selects from a spinner, which works.

public void addInput(){

    double dblCostInput = Double.valueOf(inputBox.getText().toString());
    String strCategories= spinnerCategories.getSelectedItem().toString();

    if(strCategories.equals("Alcohol"))
    {


        alcoholSpend = alcoholSpend + dblCostInput;
        inputBox.setText("");
        nextInput();
        inputBox.setText("Your Spending on"+strCategories+" is: " +d.format(alcoholSpend));




    }

© Stack Overflow or respective owner

Related posts about android

Related posts about variables