If getText returns String below code will work.
String message = txtaMessage.getText();
String transaction1 = txtfAmountTransfer.getText();
String reciever = txtfTransferTo.getText();
lblOutputTransferInfo.setText("Your Amount of "+transaction1+" has been sent to "+reciever+" .");
lblOutputTransferMsg.setText("With a Message: "+ message);
double balance = 5123.84;
balance = balance - Double.parseDouble(transaction1);//this will not work but the concept I need
lblSavingsBalance.setText(String.valueOf(balance));
If you are using android,
(Assuming txtaMessage, transaction1, reciever are either TextView objects or EditText objects)
txtaMessage.getText(); //This won't return a String. This will return a CharSequence.
You have to convert it to string. So the correct method is,
String message = txtaMessage.getText().toString();
Do this for all EditTexts and TextViews.
Then transaction1 shoud be converted as Double
Double.parseDouble(transaction1);
After that you can substract transtraction1 from balance and assign it to the original balance.
balance = balance - Double.parseDouble(transaction1)
The full version of android code is below.
String message = txtaMessage.getText().toString();
String transaction1 = txtfAmountTransfer.getText().toString();
String reciever = txtfTransferTo.getText().toString();
lblOutputTransferInfo.setText("Your Amount of "+transaction1+" has been sent to "+reciever+" .");
lblOutputTransferMsg.setText("With a Message: "+ message);
double balance = 5123.84;
balance = (balance - Double.parseDouble(transaction1));//this will not work but the concept I need
lblSavingsBalance.setText(String.valueOf(balance));
If the transaction1 value is not a number, An Exception will occur. So wrapping it with try/ catch is a good idea.
try {
balance = (balance - Double.parseDouble(transaction1));//this will not work but the concept I need
lblSavingsBalance.setText(String.valueOf(balance));
} catch (NumberFormatException e) {
//Send error message like showing a toast
e.printStackTrace();
}