Jump to content

NIRAV KAKU

Members
  • Content Count

    17
  • Joined

  • Last visited

Posts posted by NIRAV KAKU


  1. Thanks a ton Dave! I actually made decent headway!

     

    1. Added the package directive with full path of the Java file.

    2. Used the jar command and to compile into JAR file.

    3. Added the JAR file to the project Project > Android (selected), it placed the JAR file in the Libraries folder.

    image.png.4439dca19216ab98c3e8869a7a99ad05.png

     

    4. I did get an error but then I figured out it was because of the location path (apparently dx requires strict path and package name mapping). It then created UseAsJAR-dexed.jar file automatically.

    5. Changed the signature in android.JNI.UseAsJAR pas file.

    6. Removed the RegisterType call (as you suggested).

     

    But still I get the same error. 😞

     

    So frustrating!

     

     

    JNI.rar


  2. 1. You don't need to add the classes.dex file to the project, nor the .java files 
    Yes. I know that. I just added them to the project file so that I could access them easily. That's all. 🙂 Besides, seeing all the files in the project brings a certain comfort when I am on uncharted waters. What I did not know is that you don't have to recompile into classes.dex! I didn't know you could simply add a JAR file in the libraries and wrap the header to directly use it! Thats amazing !! (unless I understood that wrong??)

     

    2. The UseAsJar.java file is missing the package directive which by convention is a domain in reverse order followed by a package identifier, e.g. com.mydomain.mypackage. Also, you do not need a main method, unless you're intending to run the jar separately.
    I don't understand what 'package directive' means or how to define it. Can you give an example of it using the current case? Yes, I know main is not needed. I was trying my hands at basics first so that got left in and I didn't bother to take it out. 😉

     

    3. Your import (android.JNI.UseAsJAR) is incorrect, since the signature for JUseAsJar does not match the package/class. It should be the package name followed by the class name e.g. com/mydomain/mypackage/UseAsJar. You don't need RegisterTypes, either; I believe that's a hangover from earlier versions of Delphi.

    Again, the signature has to be a copy (with '/' instead) of the fully qualified package directive? I saw Jim's video on this (pretty dated) so I thought this was a mandatory step. 😕

     

    4. Once you've recompiled the .jar, add it to the project, in Project Manager under Target Platforms > Android. This saves having to manually deploy the classes.dex. You could then remove that manual addition.

    Cool!

     

    Thank you for all your advice!!


  3. I have rather written a very simple class in Java which I would like to consume in Delphi. I have followed the instructions to the tee (to the best of my knowledge)... however, in the end, when I do try to consume the class method, I get 'Java class JWhatever could not be found.'

     

    I have compiled the java to jar... jar into the classes.dex and deployed my classes.dex. I have written the wrapper correctly too and registered the types. 😕

     

    I have attached the full source code with the dex files. Any help would be appreciated.

     

    Nirav

    JNI.rar


  4. I am a bit confused with the above functions. I used use Image1.Bitmap.SaveToFile which generates a smaller file. However, when I do Image1.Bitmap.SaveToStream, the size is 7x of the SaveToFile method. What causes this? I would expect that both should produce the same size. What am I missing?


  5. 21 minutes ago, Memnarch said:

    Just signed in in Chrome on my Android. Asked me if i want to recieve Notifications. So if you quote me here that should push something 😉

    Okay, so I signed in from Chrome (Android) and it asked for notifications which I allowed. Bookmarked the site too. 

     

    Now I am going to shut my browser and wait to see if I get notifications. If I do... I am a happy man! 


  6. Just now, Markus Kinzler said:

    This forum works well on mobile devices, too. You don't need an app.

    Yes it does and I am not suggesting it doesn't. However, the idea of not having an app based, group focused, non push notification based forum for Delphi just doesn't sit well with me. 

     

    Maybe I just need to give it more time... It may grow on me. 😉

×