Как я могу сделать историю операций?Как сделать историю для Android-приложения?
Мне нужно сохранить результаты в массиве, а затем redender с ListActivity в Android.
Это код:
public void calculator(){
EditText screen = (EditText) findViewById(R.id.screen);
if (screen.getText().toString().equals(".")){
screen.setText("0");
}
if (screen.getText().toString().length() > 0){
this.Operand2 = Float.parseFloat(screen.getText().toString());
}
if (this.Operator.equals("+")) {
this.Answer = this.Operand1 + this.Operand2;
} else if (this.Operator.equals("-")){
this.Answer = this.Operand1 - this.Operand2;
} else if (this.Operator.equals("*")){
this.Answer =this.Operand1 * this.Operand2;
} else if (this.Operator.equals("/")){
this.Answer = this.Operand1/this.Operand2;
}else if (this.Operator.equals("^")){
this.Answer = (float) Math.pow(this.Operand1, this.Operand2);
}else if (this.Operator.equals("%")){
this.Answer = Operand1 % this.Operand2;
}else{
this.Answer = Float.parseFloat(screen.getText().toString());
}
screen.setText(this.Answer + "");
И это массив адаптер:
la1 = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, ARRAY_NAME);