Is it possible trim()
method is work on two ways data binding, when getting info from XML. If yes how?
android:text='@={contact.contactDetails.name}'
You can trim it in getter/setter method of you model class.
public class UserModel {
String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name.trim();
}
}
android get it with binding.getUser().getName()
, even you can use trim() in getName()
both will work same.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With