You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
wrong constructor for android.content.ServiceConnection #1107
In the android17.d.ts the constructor for android.content.ServiceConnection is wanting an implementation parameter which is wrong.
All implementation parameters for android constructor should be removed.
This is quite important as your tic won't work because of that and if you put a null parameter you app will crash.
@farfromrefug in the android typings we generate constructor with a given implementation for every interface as you can see from the comment above:
/** * Constructs a new instance of the android.content.ServiceConnection interface with the provided implementation. */
android.content.ServiceConnection is actually an interface, so it doesn't make sense to have a constructor for it with no parameters as you cannot instantiate it. What we do is to give you a way to provide implementation using which we will create a class implementing the given interface.
@vtrifonov I didn't know this was possible. However the constructor without implementation still exist and works. I use it all the time. The definition (dts generator) files should also contain (generate) them..
Thank you for the example. We've added the parameterless constructors in the android d.ts generator tool and in the tns-platform-declarations package with that PR - NativeScript/NativeScript#6044
Activity
vtrifonov commentedon Jul 5, 2018
@farfromrefug in the android typings we generate constructor with a given implementation for every interface as you can see from the comment above:
android.content.ServiceConnectionis actually an interface, so it doesn't make sense to have a constructor for it with no parameters as you cannot instantiate it. What we do is to give you a way to provide implementation using which we will create a class implementing the given interface.farfromrefug commentedon Jul 6, 2018
@vtrifonov I didn't know this was possible. However the constructor without implementation still exist and works. I use it all the time. The definition (dts generator) files should also contain (generate) them..
vtrifonov commentedon Jul 6, 2018
@farfromrefug can you please provide an example how you use this?
Thanks in advance!
farfromrefug commentedon Jul 6, 2018
and to create the object
this is the way listeners and such are used in almost every NativeScript module I have seen
vtrifonov commentedon Jul 13, 2018
Thank you for the example. We've added the parameterless constructors in the android d.ts generator tool and in the tns-platform-declarations package with that PR - NativeScript/NativeScript#6044
farfromrefug commentedon Jul 13, 2018
@vtrifonov that's so cool! Thank you so much!