Hi. I am trying to hack this bit of code to save the results of a
calculation to disk but it says that the variable (txt) cannot be
resolved.
Any ideas!

private void handleEquals(int newOperator) {
if (hasChanged) {
switch (operator) {
case 1:
num = num + Double.parseDouble(txtCalc.getText().toString());
break;
case 2:
num = num - Double.parseDouble(txtCalc.getText().toString());
break;
case 3:
num = num * Double.parseDouble(txtCalc.getText().toString());
break;
case 4:
num = num / Double.parseDouble(txtCalc.getText().toString());
break;
}

String txt = Double.toString(num);
txtCalc.setText(txt);
txtCalc.setSelection(txt.length());

readyToClear = true;
hasChanged = false;

}

FileOutputStream fOut = openFileOutput
("samplefile.txt",MODE_WORLD_READABL E);
OutputStreamWriter osw = new OutputStreamWriter(fOut);
osw.write(txt);
osw.flush();
fOut.close();
osw.close();
operator = newOperator;

}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to