It seems like it's not properly supported as I need to implement JNI stuff when I try to implement IActivityResultCallback
interface. Also ActivityResultContract
is not a generic class so when I inherit it to create a custom contract it's not type-safe like in native Android. So it's not usable at all at the moment I guess?
Asked
Active
Viewed 456 times
0

solru
- 111
- 1
- 8
1 Answers
0
You can get around this issue by inheriting from Java.Lang.Object
. Something like this will probably work:
public class MyActivityResultCallback : Java.Lang.Object, IActivityResultCallback
{
}
IActivityResultCallback inherits from IJavaObject, which most, if not all Android interfaces do. This way Xamarin can interface between C# and Java. This is described pretty well here: https://learn.microsoft.com/en-us/xamarin/android/platform/java-integration/working-with-jni#implementing-interfaces

Cheesebaron
- 24,131
- 15
- 66
- 118