I have a problem with TextWatcher, here is my code
JumlahTrx.setOnFocusChangeListener(new View.OnFocusChangeListener(){
public void onFocusChange(View v, boolean hasFocus){
if(v.getId() == R.id.editJumlah && hasFocus){
JumlahTrx.addTextChangedListener(onTextChangedListener());
}else{
if(JumlahTrx!=null) {
try{
JumlahTrx.removeTextChangedListener(onTextChangedListener());
}catch (Throwable e){
e.printStackTrace();
}
}
}
}
});
The code doesn't have any error. But the function not work like what i want. I want if JumlahTrx (R.id.editjumlah) is focused then add TextWatcher function, if i click on another EditText or not focus on that remove it.
Any help on my code?
Aucun commentaire:
Enregistrer un commentaire