Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
693 views
in Technique[技术] by (71.8m points)

xamarin.android - Xamarin Android, Java Bindings Library and IJavaPeerable Implementation

I have created a Bindings Library as detailed here https://docs.microsoft.com/en-us/samples/xamarin/monodroid-samples/javaintegration-aarbinding/ for a .aar file.

This exposes a method

GetBarCode (global::Com.Scandecode.Inf.IScanInterfaceOnScanListener scanListener)

IScanInterfaceOnScanListener inherits IJavaObject, IJavaPeerable.

How do I implement the inherited methods from IJavaPeerable so I can call this method?

void SetJniIdentityHashCode(int value)
void SetPeerReference(JniObjectReference reference)
void SetJniManagedPeerState(JniManagedPeerStates value
void UnregisterFromRuntime()
void DisposeUnlessReferenced()
void Disposed()
void Finalized()

OR Is there a problem with my bindings library? This is the example Java code given:

       scanDecode.getBarCode(new ScanInterface.OnScanListener() {
            @Override
            public void getBarcode(String data) {
                scancount+=1;
                tvcound.setText(getString(R.string.scan_time)+scancount+"");
                mReception.append(data+"
");
            }

            @Override
            public void getBarcodeByte(byte[] bytes) {
                //返回原始解码数据
//                scancount+=1;
//                tvcound.setText(getString(R.string.scan_time)+scancount+"");
//                mReception.append(DataConversionUtils.byteArrayToString(bytes) +"
");
            }
        });

ScanInterface.OnScanListener does not appear to be generated by the Bindings library.

Background: This is for integration with a hardware barcode scanner on a Newland SD100 tablet.

Edit: Seems similar to implementing IEventListener, will do some more research

question from:https://stackoverflow.com/questions/65887864/xamarin-android-java-bindings-library-and-ijavapeerable-implementation

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...