java logic with flutter ui - java

I have written a huge java programm (about 6000 lines of code including UI) with javaFX. I decided to convert this project to a flutter project to be cross-platform and make it look nicer. My idea was, that I could just use my Java logic in the flutter project, which actually works pretty easy via MethodChannels in the android directory of a flutter App, but here is my question:
Does this android directory in the flutter project make the project only viable for android (as long as I dont make a similar version for iOS)?
Is there any other way to use my android code other than this android directory (maybe in the normal lib directory)?
Edit: Reworked my questions to make clarify what I was asking for

Related

How to develop an Android application without Android Studio?

I've installed and set up Java JDK 17 as well as Android SDK (the manual way) on my Ubuntu 22.04.
From there, is it possible to develop an Android application in Java WITHOUT Android Studio ?
Developing through the command line or through a light IDE is fine by me, but there are very few guidance and information out there.
Thanks to enlighten me.
Sure you can! You'll need to type an awful lot of stuff though, that Android Studio does for you automatically:
You'll need to create gradle files to build your project, you'll need to create an Android manifest to describe your Android components and your app (permissions, themes, target SDK, etc.).
You'll need to create the code files containing your Android components (Activity, Fragment, Service, BroadcastReceiver, etc.). You'll need to create all your UI definition files in XML (layouts and other resources).
Then you can use gradle on the command line to run all the necessary preprocessors, code generators, compilers, linkers, resource builders and package builders to give you an APK which you can then install on your device for testing. And you can debug by writing lots of stuff to the logs and using adb commands to get the logcat off the device to see the log messages, exceptions and stack traces.

Run *.jar file on Android

I copied the program from this link: Memo Game and turned it on on Eclipse. Everything worked properly. What if I want to try it on my Android device? I download BlueStacks and exported Eclipse project into Runnable JAR file. Then I tried to turn this file on using this guide but I couldn't do it. I found the whole process very difficult and I am sure there are easier methods to write Android applications.
Main question: What should I do in order to turn on a normal Eclipse application that I write and test on my computer on Android? Is it at all possible?
I know that there is a program called Android Studio, but there you use specific commands that I am not familiar with. That's why I am asking about turning on the same code I write on computer but on Android.

Eclipse Programs to Android Studio

Is there any way I can call .java files from eclipse to programs in android studio and have that code be run from android studio? I cannot have the code directly copied into android studio as it brings up multiple issues. So I am wondering if there is some way I can call the .java from Eclipse, get the result from the method within that Eclipse program, and pass that result to android studio.
Any help would be greatly appreciated!
Very simply, no you can't "just call" code from another IDE.
You could export the Eclipse code to a JAR, import as a library into Android Studio, then try to work around that, but that sounds like a lot of work.
In regards to your previous questions, plus your comment.
it was working in eclipse, but when I literally copy and paste that exact same code into android studio, I am getting network issues when I run it.
Android has a UI Thread that does not like to handle Network requests like your bare single-threaded Eclipse project.
You need a separate thread. Without any libraries, there is AsyncTask, and the Android documentation covers this.
Though, you may find OkHttp to be better documented, useful, and less confusing than AsyncTasks. Volley is another, though works fine, is not very well documented.
See more discussion at Comparison of Android networking libraries: OkHTTP, Retrofit, and Volley
No, This is not possible way to do. Android studio and eclipse are different Applications and you cannot pass the Result to each other.
You can import the project or copy the files for a new Project.

Questions regarding Windows/Android development (Java:APK/JAR)

I'm planning to write a software (with GUI and sounds) that should run under Android and Windows 7/8
I guess the best approach for this is to use Java?
I am new to Android and Java development so my questions are:
-So can I use one development platform to create both (APK & JAR), namely Java?
-As far as I understand for Android I need to compile (from same source?) a .APK file and for Windows a .JAR file ?
(The .JAR will run in the Java Runtime that is installed in Windows)
-If I use Java what would be the best IDE, something like Google's Android Studio (will it allow to create .JAR?) or Oracle's JDK (Java SE Development Kit) ?
thank you
I don't think it is possible to write an app that will run on both OS's, since all GUI components are part of different frameworks (Android SDK for Android, SWT/Swing/... on Windows), and not compatible with all OS's.
You best bet is probably a web-based app. You can run it in the browser on dektop and either on a mobile browser on Android, or package it as a fullscreen WebView running your web app. The best part is it would also work on iOS.
You could also write your app for desktop in Swing and then convert it to an Android app, you can find questions on StackOverflow on the subject, such as this one.
Hope this helps ;)

Making apk from jar using microemulator

Well i `ve made an app using java me and as graphics i used lwuit library which i added into the midlet`s jar. On Nokia it runs smooth and i wanted to port it to android. So i found out about microemulator http://microemu.blogspot.ro/2008/11/running-java-me-applications-on-android.html and i followed those steps and i got the apk. However when i run it into the Android Emulator it closes at start. I don`t know what may be the problem because i was able to convert the demo jar app into apk and it ran succesfuly.
Any ideas on what should i do?
I suggest you port your application to Codename One which should be pretty simple. It has proper Android support which will make your application look and act native on Android.

Categories