laxmanperamalla
laxmanperamalla

Reputation: 551

how to generate result automatically calculation of two numbers?

hi all how to implement addition of two numbers code without using button the result should be generated automatically when we enter value into text fields from key board, help me to solve the problem.

Upvotes: 0

Views: 166

Answers (1)

havexz
havexz

Reputation: 9590

You can use TextWatcher like below code:

editText.addTextChangedListener(new TextWatcher() {

@Override
public void onTextChanged(CharSequence s, int start, int before,
        int count) {

}

@Override
public void beforeTextChanged(CharSequence s, int start, int count,
        int after) {

}

@Override
public void afterTextChanged(Editable s) {

}
});

Refer:

TextWatcher

Upvotes: 4

Related Questions