I created a converter app, I used 2 edit text one which gets input and other display output it will display output by clicking on button is there any way to get the output display in 2 edit text without using click event of button. I want to get result automatically placed in 2 edit text when we enter input in 1 edit text.
EditText input,result;
input = (EditText) findViewById(R.id.ip);
result = (EditText) findViewById(R.id.res); // my edit texts input and result
result.setClickable(false);
public void convert(View view){ //when clicking it get result to 2 edit text, but I want to get automatically to the second edit text when user enter the input
if (!input.getText().toString().equals("")){
ufrom = (String) sp1.getSelectedItem();
uto = (String) sp2.getSelectedItem();
Double ip = Double.valueOf(input.getText().toString());
TemperatureConverter.Units fromUnit = TemperatureConverter.Units.fromString(ufrom);
TemperatureConverter.Units toUnit = TemperatureConverter.Units.fromString(uto);
double r = con.TemperatureConvert(fromUnit,toUnit,ip);
result.setText(String.valueOf(r));
} else {
result.setText("");
}
}
Hope it will help you my friend !
you can use TextWatcher for this purpose. You wil get the each character value in this listener.. Update your output editText according to your needs
yes you can you by detecting keyboard action done
i.e.