You have two ways to do this:
Do character by character processing of one field to calculate the other field
For this you may use the addTextChangedListener with a text watcher where you change the onTextChanged method to process the data.
//some main function
//editHandle is your EditText
//from editHandle = (EditText) findViewById(R.id. <<your EditText>> );
editHandle.addTextChangedListener(redoWatcher);
}
private TextWatcher redoWatcher = new TextWatcher() {
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before,
int count) {
recalculate();
}
@Override
public void afterTextChanged(Editable s) {
}
};
Now you can write the recalculate method to process the data.
2 . The other method is to calculate the data when the user changes focus to the other field.
Here you need to use the onFocusChangeListener
<Your EditView>.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
recalculate();
}
});
Either way, depending on the design you might want to check for valid input.