How to Convert Java Files to Delphi Units for Android with Winsoft JavaImport
If you are a Delphi or C++ Builder developer who wants to use Java libraries or classes in your Android applications, you might be interested in Winsoft JavaImport for Android 3.9 Full Source[^1^]. This tool converts Java .jar files, .class files and folders to Delphi/C++ Builder units for Android, allowing you to access and use Java APIs from your native code.
In this article, we will show you how to use Winsoft JavaImport for Android 3.9 Full Source to convert and import some common Android classes, such as Toast, Gravity and BatteryManager. We will also demonstrate how to use the imported classes in a simple Android application that shows a toast message with the battery level.
Step 1: Download and Install Winsoft JavaImport for Android 3.9 Full Source
You can download Winsoft JavaImport for Android 3.9 Full Source from the official website[^1^]. The download file is a zip archive that contains the executable file (javaimport.exe), a readme file (README.TXT) and some example projects for Delphi and C++ Builder. You can extract the zip file to any folder on your computer.
To install Winsoft JavaImport for Android 3.9 Full Source, you just need to run the executable file (javaimport.exe) and follow the instructions on the screen. You can choose the installation folder and the Delphi/C++ Builder versions that you want to support. The tool will create a subfolder named \"JavaImport\" under the installation folder, where it will store the converted units and other files.
Step 2: Convert Java Files to Delphi Units
To convert Java files to Delphi units, you need to launch Winsoft JavaImport for Android 3.9 Full Source from the Start menu or the desktop shortcut. You will see a simple user interface that allows you to select the source files and the output folder.
You can convert one or more Java .jar files, .class files or folders that contain Java files. To select the source files, you can use the \"Add\" button or drag and drop them from Windows Explorer. You can also use the \"Remove\" button to remove any unwanted files from the list.
Next, you need to specify the output folder where the converted units will be saved. You can use the \"Browse\" button or type the folder path manually. You can also choose whether to create subfolders for each package name or not.
Finally, you can click the \"Convert\" button to start the conversion process. The tool will scan the source files and generate Delphi units for each Java class or interface. You can see the progress and status of the conversion in the log window at the bottom of the user interface.
Step 3: Import and Use Converted Units in Your Android Application
After converting Java files to Delphi units, you can import and use them in your Android application as if they were native classes or interfaces. To do so, you need to add the converted units to your project and include them in your uses clause.
For example, if you want to use the Toast class[^2^], which displays a small pop-up message on the screen, you need to add the unit android.widget.Toast.pas to your project and include it in your uses clause:
Then, you can create an instance of JToast (the Delphi interface for Toast) by calling its static methods makeText or init. You can also set some properties of JToast, such as duration, gravity, margin or text. Finally, you can call its show method to display it on the screen.
For example, if you want to show a toast message with the battery level when a button is clicked, you can write something like this: aa16f39245