Is there any way of using Android’s UI libraries etc to build an GUI in a plain Java application?
I am building a program that will run both on Android and computer.
I figured if I use Android’s libraries and paradigms it will be much easier to have it running on both platforms.
Android and normal Java UI libraries are different. The Android UI is specially tailored to… Android. Every View in Android has a Context and other things that desktop Java just plain doesn’t have or implements differently. However, do keep in mind that UI functions are usually similar (eg Buttons have listeners, and so do many other UI elements) – so while there is no simple way to do native convertion from Swing/Some other desktop UI to Android UI, you shouldn’t have too much trouble with recoding them.
What you need to do is make the logic & non-UI classes their own file and then make separate UIs for your application depending on the platform you code for.
Of course, if you don’t want to make anything native, you can use a webapp approach – that would be the easiest and you can target the most devices with the least amount of time.