c# classLibrary.dll to be used in android studio/ android app - java

This is kind of a general question but anyway:
In c# I have made a class library(api) which works on windows systems. I am now looking into making an api with the same functionalityies for android. One of the functionalityes (streming data from custom bluetuth device) needs to be written in java. So (in android studio) I have written a java class to do that, compiled a .jar and tested it in Unity as a plugin. But to avoid translating a ton of c# code into java I am now wondering if it is possible to somehow import a c# api into android studio and just call it's methods from java classes( as you can do in Unity's.Monobehaviour (AndroidJavaClass.Call("functionName", object[]parameters)) or maybe as you can do wit .jar-s code in VisualStudio(IVKM.Net. IVKM.NET))? To put it as plainly as possible: I would like to convert a api.dll to api.jar.
If you can suggest another alternative solution, please do so.
Thanks.

Havent tried, but will try hinting towards C++ support in Android with Native development Kit by converting C# to C++ code, as in .net all of your code is CLI code anyways, so it should be convertible to some barely readable C++ surogate code which should compile just fine.
https://www.quora.com/Can-we-use-C++-and-Java-together-in-Android-Studio
Hope this helps!

Related

Is there any way to use Swift for iOS as well as android development?

When having a finished iOS app, coded with Swift via Xcode, is there any way to use the code and in general the project file and kind of transfer it into Java, C or C++ code which that can be used to create an android app?
Learning an additional programming language, such as Java or C, "just" so I can publish two these two stores isn't hopefully the only solution to this kind of problem.
I´d appreciate any of your past experiences and ideas related to my problem.
You could have wrote it initially in React Native for example, or using Flutter or Xamarin or whatever framework you wanted to write once and then run on both iOS and Android.
If you want an app with GUI and not a simple HelloWorld, i don't think so, as far as I am aware there is no way to do it.
There is a possibility to COMPILE a Swift code on Android, of that I am sure, but to run an app out of the box without using some additional frameworks - nope.

Is there a way to call a Java class from a Visual Studio Windows Forms Application?

I mainly program in Java, but I often do GUI things on Visual Studio. I have written a program in Java that is fairly comprehensive and long, and I do not know how to rewrite it in Visual Basic. Is there any way I can call methods or create objects in Visual Basic that is based off of a Java class, or are there other ways I can implement or import Java snippets into Visual Studio?
I saw something like this, and I'm not sure how it works:
Private Sub Command1_Click()
Set x = CreateObject("MyTest")
MsgBox x.myfunction(500, 500)
End Sub
I saw some information on "bridges," but my goal is to do things just on my PC and not on the cloud.
Realistically, you're probably going to have to spend a lot of time working with JNI and P/Invoke (or whatever .NET's native interfaces are these days) to get Java code talking natively with managed code on .NET in the same process. You're better off just wrapping your Java code with Spring Boot and calling it as a service.

Does RoboVM convert swing java apps?

I have looked and I cant find the answer. Id like to know before i begin this project, but does RoboVM convert java directly to iOS aka objC? Does this work for both Java and Android? Does this also include java Swing? Im wondering if I can convert my java game directly to iOS. Thanks,
RoboVM converts what you have in Java into bytecode that will run on iOS.
You can't run Android-specific code (anything that has "android" in the import) on iOS, so you will have to add iOS methods that do similar things. Generally you create an Interface that asks the "native client" to do something, and then the Android or iOS code handles the request for the current native client.
Java Swing should work, although I have not tried it personally.

Exporting C++ project to Android - JNI/JavaCPP/Visualgdb

I am facing a critical issue trying to export my opencv project to android.
Since all of my code is in opencv (C++ version) under visual studio 2013, i started off looking into JNI. I ended up realizing that JNI works good when we export C stuff as name mangling is turned off. Does this affect my C++ code? I think it should as name mangling has to be there for C++ class functions.
Then I found out about JavaCPP. This seemed more promising but the extra overhead its Pointer logic seems strange to get my head around and extra build steps to create .so files.
And finally, read about Visualgdb. Though seems to be in trial, but with my liking for Visual studio, looks reasonable.
Can someone guide my which way I have to follow to translate/bind my code in android so that I can export my c++ classes? Does plain JNI have a real issue with C++ code and no problems with C? OR do I go for JavaCPP or visualgdb?
You valuable comments will be highly appreciated.
Thanks
AFAIK you can use JNI on your c++ code, I'm using it. But you should only use JNI if you want to write all your code in c++ and want java to use that exact c++ code in java side. And for that you should export all functions in your public API. And I must say, passing through custom objects such as Mat, Rect, etc is not a very easy problem, also debugging is not also straight forward. I suggest you to use OpenCV Java and port your code to Java.
Good luck!

Python for Android Apps

I've learnt python recently and I want to make an app for android. But everywhere on the net, it seems Java and Eclipse are the only ones that can be used.
So, my question is:
1) Can I use python to make an android app?
2) What kind of platform should I use to make an app with python?
Thanks guys!
If you're just looking to run Python scripts, try QPython.
If you're looking to make your Python code run like a native app, or just something more robust than the above, try SL4A.
If you're looking to effectively use Python as a library, and compile an .apk with the Python library included, try Kivy: github.com/kivy/python-for-android.
That said, you'd likely get a lot of benefit from learning Java, and not just for programming natively in Android (which would give you access to a much wider feature set and make your app run more efficiently).
Check out the Scripting Layer For Android, aka SL4A.
Here is a blog for getting started. The blog promises more entries in the series but there don't seem to be any. Still, it is a great starting point. There's quite a few parts to pull together so be patient and check the bottom of that blog entry for dozens of useful links.
If you want to contain everything to the Android device, including the IDE (pretty slick), check this out.
Here's a book from APress that could help with more advanced concepts: Pro Android Python with SL4A

Categories