Giter Site home page Giter Site logo

Comments (8)

mhofman avatar mhofman commented on May 17, 2024

I'm getting the same error when overloading on number of arguments.

    public static interface Logger {
        public void print();
        public void print(Object value);
    }

from android.

slavchev avatar slavchev commented on May 17, 2024

Implementing Java interfaces require different syntax. You cannot use extend functions for this purpose. Use new and pass the implementation object as a single constructor parameter. Here is an example from the documentation https://github.com/NativeScript/docs/wiki/Getting-Started-with-NativeScript-for-Android#how-to-implement-an-interface

I will investigate the case with DummyLogger class further.

from android.

mhofman avatar mhofman commented on May 17, 2024

@slavchev as you can see in my code I do extend the class and new the interface. The code is valid, that's not the problem. It's the runtime that is not behaving right.

from android.

blagoev avatar blagoev commented on May 17, 2024

Indeed we have identified a bug and a fix is already in the works. Thanks for reporting this.

from android.

blagoev avatar blagoev commented on May 17, 2024

The master have been updated with the fix for that, closing this issue.

from android.

x4080 avatar x4080 commented on May 17, 2024

Hi, I found that implementing firebase CompletionListener is not working :
{ To notify if firebase set is completed, I checked the firebase nativescript plugin is not implementing this function, so I tried it on my own and it failed }

        var complete = com.firebase.client.Firebase.CompletionListener.extend({
            onComplete: function (err, firebase) {
                console.log('complete');
            }
        });

        ref.child(url).setValue(object,new complete);

and here's the firebase android doc for it

public static interface Firebase.CompletionListener
void onComplete(FirebaseError error,
                Firebase ref)

and here's the error message

com.tns.NativeScriptException: 
Calling js method onClick failed

Error: com.firebase.client.FirebaseException: Failed to parse node with class class com.tns.gen.com.firebase.client.Firebase_CompletionListener_fservice_firebase_l161_c72__
    com.firebase.client.snapshot.NodeUtilities.NodeFromJSON(NodeUtilities.java:84)
    com.firebase.client.snapshot.NodeUtilities.NodeFromJSON(NodeUtilities.java:12)
    com.firebase.client.snapshot.PriorityUtilities.parsePriority(PriorityUtilities.java:29)
    com.firebase.client.Firebase.setValue(Firebase.java:268)   

Is the android method override has limitation on parameters?

Thanks

from android.

slavchev avatar slavchev commented on May 17, 2024

@x4080

We don't support extend syntax for Java interfaces. Use new instead as follows (code never tested)

        var complete = new com.firebase.client.Firebase.CompletionListener({
            onComplete: function (err, firebase) {
                console.log('complete');
            }
        });

        ref.child(url).setValue(object,new complete);

from android.

x4080 avatar x4080 commented on May 17, 2024

Ill try.. Thanks

from android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.