Eclipse Programs to Android Studio - java

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.

Related

java logic with flutter ui

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

What options are there to call Lua code within an android project?

I want to take this open-source project, which is a build calculator for the online game Path of Exile, and port it to an android app. The project, called Path of Building (PoB), is written fully in Lua, and is released as a windows application. I'm not sure to what extent it's possible to simply wrap their lua code and just show it in an activity, but, since the project gets updated often (just as much as the game, which is once every three months), I'd like to touch as little of their code as possible and hopefully just have to set it up in Android. Any help or input is appreciated.
You can run Lua code on Android using a library called luaj.
Take a look at luaj site: http://www.luaj.org/luaj/3.0/README.html

Code completion XML not working on Android Studio

I was working on an android project for homework, and suddenly, while I was designing a layout, I realized that the code completion wasn't working, and I don't know why.
Here I post some photos:
XML not completing
However, when I try to code some Java, the completion is working.
Java does complete code
I don't know how to revert that, I tried to Invalidate Cache, turning off power saving mode, and nothing works.
Change your gradle version from the one you are using presently. Then close and open project again.
Try restarting studio and Sync Project with Gradle files

Android Studio - package java.awt.image does not exist

I have a problem running my project on Android Studio. I am working on an Android project that has a native Java library inside it. It was running fine all the time. But suddenly when I open Android Studio, I find this error:
There is also an error in the .gradle of the project:
It says that URI is not registered.
When Android Studio is started, I find this message:
It seems that there is something wrong in Java configuration, but I can't find out what is the problem?
It was running fine all the time
Not on Android, it wasn't.
It seems that there is something wrong in Java configuration
No. You are using classes that are not part of the Android SDK.
The java Swing and AWT API are not part of the Android SDK and thus aren't including with it. You must find an Android equivalent image library to use in your app. There are few good ones around just depends on what functionality you need to have available to you in you app. Try searching Picasso and or Volley. Picasso is very popular and well known. it has a lot of feature including networking functionality for loading images from the web. The Volley library isn't an image library but an networking library that contains some predefined classes for loading images over the internet.
So this just happened to me. I'm not 100% on the details of how I got it working again, but its roughly this (on my Mac):
Quit Android Studio
I went to ~/Library/Application%20Support/ and deleted the AndroidStudio3.2 directory
I relaunched Android Studio and I got some warning dialog about plugins not existing.
Chose the button that is something about reinstalling or fixing (or whatever isn't deleting or ignoring)
Another dialog comes up. There are a bunch of plugins that are in red. Deselect all the red ones. Then reselect all those ones that were previously red.
Android Studio asks you something and if you want to restart Android Studio. Pick the thing that includes restarting.
And once Android Studio restarts, chose to rebuild your project, and then it worked.
Good Luck and I hope this works for you too.

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