public class Plugin01 : Com.Wikitude.Common.Plugins.Plugin { public Plugin01(string p0) : base(p0) { } Frame currentFrame = null; public override void CameraFrameAvailable(Frame p0) { System.Diagnostics.Debug.WriteLine("AVAILABLE FRAME"); try { var data = p0.GetData(); currentFrame = p0; } catch (System.Exception ex) { } } public override void Update(RecognizedTarget[] p0) { System.Diagnostics.Debug.WriteLine("AVAILABLE FRAME"); if (p0 != null) { if (currentFrame != null) { // ConvertYuvToJpeg(currentFrame, p0[0]); } } }}我已经注册了插件,但没有调用公共重写void Update(RecognizedTarget [] p0)方法....我在这里做什么错了?I have registered the plugins but it is not callingpublic override void Update(RecognizedTarget[] p0) Method....What am I doing wrong here ?推荐答案我认为问题是使用错误的方法调用"RegisterPlugin",因为您知道调用活动方法的周期不同.您应该在"OnPostCreate"中调用活动方法.尝试下面的代码,让我知道结果:I think the problem is calling "RegisterPlugin" in the wrong method, as you know the cycle of calling activity methods are different.you should call it in "OnPostCreate" method of activity.try below code and let me know the result:protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); try { SetContentView(Resource.Layout.Main); architectView = FindViewById<ArchitectView>(Resource.Id.architectView); var config = new ArchitectStartupConfiguration(); config.setLicenseKey(WIKITUDE_SDK_KEY); architectView.OnCreate(config); } catch (Exception ex) { Toast.MakeText(this, ex.ToString(), ToastLength.Long); } }protected override void OnPostCreate(Bundle savedInstanceState) { base.OnPostCreate(savedInstanceState); if (architectView != null) architectView.OnPostCreate(); try { try { string url = string.Format(@"file:///android_asset/01_ImageRecognition_1_ImageOnTarget/index.html"); architectView.Load(url); Plugin01 cardPlugin = new Plugin01("com.plugin.dpiar"); architectView.RegisterPlugin(cardPlugin); } catch (Exception ex) { } } catch (Exception ex) { Toast.MakeText(this, ex.ToString(), ToastLength.Long); } }考虑更改变量名称. 这篇关于如何在Xamarin表单中使用Wikitude插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
06-03 23:18