What is the best approach to port an Android application to Windows?
I used Eclipse with the Android SDK to develop the开发者_Go百科 original application. I ask since this was my first Java (and Eclipse, and Android, and XML) project. I assume that most of the Java should run on the PC without too much trouble. I may want to restructure the code to isolate the Android specific functions. Should I stay with Eclipse or move to something like NetBeans? Any advice would be terrific.
Eclipse vs Netbeans is irrelevant to your problem. They are both just glorified text editors that let you edit java code, with a little bit of compilation help. You can write any java app in either, its really just personal preference.
The ease of porting to windows really depends on what your application is. If you have a large chunk of code that is not dependent on any of the UI or lifecycle stuff, then you should be able to create a separate java library for that and reference it in both your android app, and your windows app.
The challange will be replacing the UI. As Fredley mentioned, swing is the built in option. Its a bit of a pain, but you should be able to find plenty of documentation on it.
If your application is tightly tied to the UI, then you are going to have a very hard time finding any code in common.
Assuming that most of your code is in Android-independant classes, your biggest hurdle will be the GUI. Investigate swing to start off with.
The choice between NetBeans and Eclipse is largely one of preference. NetBeans has some nice GUI tools- but so does Eclipse. In my opinion, it's usually best to stay with what you know.
Here's a decent post on the subject of Java IDEs: What is the best free IDE for Java Programming
精彩评论