Android EditText Binding is interrupted after updating MvvmCross from 4.2.3 to 4.4.0 with Linker enabled

My MvvmCross Android application that has been working so far does not work due to the update of MvvmCross from 4.2.3 to 4.4.0

<EditText android:layout_width="match_parent" android:layout_height="match_parent" local:MvxBind="Text Login" /> public string Login { get { return _login; } set { SetProperty(ref _login, value); } } 

LinkerPleaseInclude, of course, if there is:

 public void Include(EditText text) { text.Enabled = !text.Enabled; text.TextChanged += (sender, args) => text.Text = "" + text.Text; text.Hint = "" + text.Hint; text.Click += (s, e) => text.Visibility = text.Visibility - 1; } public void Include(TextView text) { text.TextChanged += (sender, args) => text.Text = "" + text.Text; text.Hint = "" + text.Hint; text.Click += (s, e) => text.Text = text.Text + ""; } 

Only Linker "SDK Only" is included. For a disabled linker, it works great. Other bindings work fine (buttons, visibility, etc.).

How to tell the linker about this correctly? What could be wrong here?

+5
source share
1 answer

The binding target for EditText and TextView uses the AfterTextChanged event, which is likely to be bound. Add this to your Include methods instead of TextChanged , and it should work:

 public void Include(TextView text) { text.AfterTextChanged += (sender, args) => text.Text = "" + text.Text; text.Hint = "" + text.Hint; text.Click += (s, e) => text.Text = text.Text + ""; } 

I don’t think you need a separate method for EditText , since EditText inherits from TextView .

+14
source

Source: https://habr.com/ru/post/1259304/


All Articles