问题
In Xamarin, I have coded a class that implements the View.IOnTouchListener
interface.
Here is my code:
public class OnTouchListener : View.IOnTouchListener
{
public bool OnTouch (View v, MotionEvent e)
{
return true;
}
void IDisposable.Dispose ()
{
throw new NotImplementedException ();
}
IntPtr Android.Runtime.IJavaObject.Handle {
get {
throw new NotImplementedException ();
}
}
}
What values do I need for the IDisposable.Dispose
and Android.Runtime.IJavaObject.Handle
code items, rather than the throw new NotImplementedException ()
code?
Thanks in advance
回答1:
You should inherit Java.Lang.Object in your OnTouchListener like this
public class OnTouchListener : Java.Lang.Object, View.IOnTouchListener
it will implement Handle and Dispose
you should do this whenever implement any Java interface
来源:https://stackoverflow.com/questions/24502974/implementing-the-view-iontouchlistener-interface