[mono-android] Problem with setting of EditText.TextChanged

Michal Sartoris miso at resco.net
Fri Mar 11 10:25:57 EST 2011


Hello,



I'm having problems with adding TextChanged event handler to EditText. It is randomly crashing with this exception:



E/mono    (12288): [0xafd4a830:] EXCEPTION handling: System.InvalidCastException

: Cannot cast from source type to destination type.

I/MonoDroid(12288): UNHANDLED EXCEPTION: System.InvalidCastException: Cannot cas

t from source type to destination type.

I/MonoDroid(12288): at Java.Lang.Throwable.HandleToException (intptr) <0x00070>

I/MonoDroid(12288): at Android.Runtime.AndroidEnvironment.GetExceptionForLastThr

owable () <0x0004b>

I/MonoDroid(12288): at Android.Runtime.JNIEnv.FindClass (string) <0x00057>

I/MonoDroid(12288): at Android.Runtime.JNIEnv.FindClass (System.Type) <0x0002b>

I/MonoDroid(12288): at Java.Lang.Object..ctor () <0x0002f>

I/MonoDroid(12288): at Android.Text.TextWatcherImplementor..ctor (object,System.

EventHandler`1<Android.Text.TextChangedEventArgs>,System.EventHandler`1<Android.

Text.TextChangedEventArgs>,System.EventHandler`1<Android.Text.AfterTextChangedEv

entArgs>) <0x0002b>

I/MonoDroid(12288): at Android.Widget.TextView.add_TextChanged (System.EventHand

ler`1<Android.Text.TextChangedEventArgs>) <0x0004b>



My code:



_textField.TextChanged += (s, e) =>

                    {

                           var fn = FilterChanged;

                           if (fn != null)

                           {

                                  fn(this, EventArgs.Empty);

                           }

                    };



This is working most of the time, but sometimes it crashes. Any suggestions or should I submit a bug report?



Best regards,



Ing. Michal Sartoris

Resco.net<http://resco.net/>



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/mailman/private/monodroid/attachments/20110311/7abcfd83/attachment.html 


More information about the Monodroid mailing list