questions about native interfaces

42 views
Skip to first unread message

Dave Dyer

unread,
Oct 27, 2016, 4:54:34 AM10/27/16
to CodenameOne Discussions

I got one working, but I have a few questions.

1) I spent a while looking for the special sauce that made the "native" folder
associated with codename1 projects special.   Eventually I concluded that
the only thing special about them was how they are used in the build file.
Other than that, they're just an ordinary non-source folder.  Correct?

2) There seems to be no provision for a "no native interface" for a platform,
so even though my interface was for android only, I had to implement a minimal
"not supported" interface for IOS.  Did I miss something?

3) this minimal "not supported" interface didn't seem to be required to
implement all the signatures required by the interface, as long as the
"supported" interface returned false and was respected.  Is that correct
or did I just get lucky not to have problems due to the missing signatures?

4) I assume by the structure of the interface methods, that if I used
NativeLookup.create(Class.forName("someclass")) as a way of avoiding
an explicit dependency on someclass.class, the whole mechanism would
not work.  If it did work, this might be around having a dummy "not-supported"
class.


Shai Almog

unread,
Oct 27, 2016, 10:31:04 PM10/27/16
to CodenameOne Discussions
Didn't you use the plugin to generate the native code?
Stubs are generated automatically for all the platforms so there is no real work. Yes you need to have stubs for every platform.

3. We can't guarantee that behavior.

4. We deprecated Class.forName() for a reason.

Dave Dyer

unread,
Oct 28, 2016, 11:46:25 AM10/28/16
to CodenameOne Discussions

Didn't you use the plugin to generate the native code?

No, how do I do that?  The "generate native" function presents a pop-up that
claims "project needs to be compiled first"

Shai Almog

unread,
Oct 28, 2016, 10:24:36 PM10/28/16
to CodenameOne Discussions
I have some vague recollection that you did some "creative" things with your project structure?

I suggest creating a new project and generating the stubs there. This is automatic.

Dave Dyer

unread,
Oct 29, 2016, 3:12:05 PM10/29/16
to CodenameOne Discussions
Yes, that allowed the process to run.   I imagine the feature of my projects
that tripped your code is that my source folders are linked rather than embedded
in the project structure.
Reply all
Reply to author
Forward
0 new messages