Xamarin 中的接口回调 [英] Interface Callback in Xamarin
本文介绍了Xamarin 中的接口回调的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 c# 从 Xamarin 中的 java 库编写接口回调,下面是代码片段,
I am trying to write a interface callback from a java library inside Xamarin using c#, Below is the code snippet,
Connector.getInstance().login(email, new ILoginCallback() {
@Override
public void onSuccess(long heloUserId) {
/* call the required Activity for successful login */
}
@Override
public void onPinverification() {
/*call the Pin verification activity to validate pin */
}
@Override
public void onFailure(String description) {
/*show the toast msg for failure*/
}
});
我无法在 C# 中进行接口回调,这阻止了我获得成功或失败的结果.
I am unable to do interface callback in c# which blocked me to get the success or failure result.
感谢任何帮助.
推荐答案
实现你的界面如下
public class MyLoginCallback : Java.Lang.Object, ILoginCallback, ISerializable
{
public MyLoginCallback()
{ }
public MyLoginCallback(IntPtr intPtr, Android.Runtime.JniHandleOwnership handleOwnership)
{ }
// implement the interface methods here
}
这篇关于Xamarin 中的接口回调的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文