arsd.jni
jni
my.email at gmail.com
Mon Dec 12 01:19:23 UTC 2022
On Sunday, 11 December 2022 at 14:24:18 UTC, Adam D Ruppe wrote:
> I don't know how to do much of anything on Android, but if you
> can post a small Java code example, I can suggest how to use it
> from D. You can bind many classes through the jni.
>
> The biggest limitation is you can't do callbacks or subclasses
> through android jni, so it is kinda limited for interactive
> components.
> Always prefer to use Java code instead of NDK library code.
> I'm not saying to not use D, I'm saying that using NDK libraries
> such opensl es asset manager other ones are really trickier to
> use.
> If you're just starting to code for android ndk
> prefer doing the work inside java and using D to call
> the java method that you need. This is the main advice
> I can give you. And never use native activity.
> Too much work for nothing.
Just as I thought. I had too much of Java years ago and I am
not going through that again and will have to use the
documentation! I would rather use Javascript! I kid. I know the
hate. I understand, but it's not so bad I think. I make apps in
Javascript easily. No problem at all. This occasion? It is not
possible.
On the android forums they suggested I use a generator on the
files I need from the NDK, but I will not do that and I will do
the classes one by one by hand as I use them. I can't use Java.
Like an old girlfriend once I say enough is enough I will go and
I don't look back. I do like it better than Kotlin from what I
have seen, so that is why I choose to do it all in D.
I will look through the NDK for the classes I need then. The
two things that were most important for a reply from you lot are
exactly on using these header files of inside the NDK? of which I
only have used extern(C) on the moments after learning the D
language. Too many years ago. That and I don't mind writing the
boilerplate code as you say maybe I could try binding some if I
can figure out how without writting any Java. That is why I was
trying to avoid to use the jni. I mostly worry about keeping
things maintainable for when I decide to use the module again for
some other android project that I can not do with Javascript.
The boilerplate is easy but Then the other part is a problem
for me is the necessary other Java classes. They are not part of
the NDK so the only way to load the jar is to use jni? Is that
correct? I saw a jartoD function in arsd.jni but I wasn't sure
how it fit into the lib or what it was used for "translator"? I
wasn't sure. For the Apache client library and the other 2 jar
classes I will use with it then writting all the Java binding
seems inevitable. This makes me want to use D more and more. A
much better language in my opinion. If I ever decide that I
should to use a C library as a replacement for the D curl library
then that will be additional work. I was wanting to ask the
experts to see the best way to do these but I guess there is no
easy way. On github there was what I saw a partial NDK headers
for D project but the classes I need were not there. I prefer NDK
livrary code because it is more acceptable for me to read and
understand the functional programming of C. All the classes of
the framework API in the SDK give me a headache! The NDK is much
nicer to menin that way.
What I want to do is fetch a file from the internet! That's
it! How did I get in this mess?
More information about the Digitalmars-d-learn
mailing list