-3

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!

  • see here : http://stackoverflow.com/questions/22791150/how-do-you-import-an-eclipse-project-into-android-studio-now – Manikandan K Nov 25 '16 at 04:28
  • 1
    You'll likely get a more reasonable response if you include the issues you have porting your code to Android Studio – OneCricketeer Nov 25 '16 at 04:33
  • @ManikandanK that's not exactly what I am trying to do. I do not want to import eclipse files in at all. I just want to know if there is some way I can run the code in eclipse, get the result, and pass it to android studio? – Programmer87 Nov 25 '16 at 04:34
  • @cricket_007 we meet again! But the issue was that, when everyone was running the code for the Spotify I posted yesterday, 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. Therefore I am looking for a different solution to this. – Programmer87 Nov 25 '16 at 04:35
  • 1
    No, you cannot do that. The IDE isn't what is running the code. The Android Device is. – OneCricketeer Nov 25 '16 at 04:35
  • @cricket_007 alright thank you – Programmer87 Nov 25 '16 at 04:37
  • I will take a look at your other question. I was going to the other day, but my IDE got uninstalled for some reason. – OneCricketeer Nov 25 '16 at 04:37

2 Answers2

1

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

Community
  • 1
  • 1
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
0

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.

David John
  • 45
  • 4