How to use AbsListView.Class.GetDeclaredMethod in Xamarin (C#)

Viewed 37

I have a code written in Java:

Method m = AbsListView.class.getDeclaredMethod("performLongPress", View.class, int.class, long.class);
m.setAccessible(true);
handled = (boolean) m.invoke(view, SwipeLayout.this, p, vId);

and I'm trying to achive the same in Xamarin, but with no luck. I tried doing it like this (C#):

var m = AbsListView.Class.GetDeclaredMethod("performLongPress");

but It gives me: "CS0120: An object reference is required for the non-static field, method, or property 'Object.Class'" error - as I understand it means that I need an instance of AbsListView but how can I get it?

The .java file that I'm trying to translate to C# is here: https://github.com/daimajia/AndroidSwipeLayout/blob/master/library/src/main/java/com/daimajia/swipe/SwipeLayout.java#L795

the problematic chunk of code starts in 1123 line

0 Answers
Related