0

How do i add the value of numOne given below to an array so that when i need a before value i can take from that array. On every time i click operator i need to store the value in array before resetting number.

public void onClickOperator(View v){
    Button op = (Button) v;
        if (stxtOutput != "") {
            if (!opt) {
                if (current_operator == "") {
                    stxtInput += op.getText();
                    num1 = "";
                    numOne = 0.0;
                    Result = pt;
                    stxtOutput = format.format(pt);
                    current_operator += op.getText().toString();
                    opt = true;
                    decimal = false;
                    update();

i have tried to add but got error,

ArrayList<Double> numb;
numb = new ArrayList<>();
numb.add(numOne);

and if the last value stored numb.add(i) i need to get the value of before value i-1

0 Answers0