1

I've created an Android application, which is generally aimed on Tablets. Its main business-logic is in pure java, it contains around 10-15 Activities, SQLite database, it performs HTTP transactions, exports information to different formats etc. My customer now (out of a sudden) wants to have exactly the same application running on Windows 7 or 8. What is the simpliest and the most straightforward way to create such an application (I do not consider using emulators)? I've never created GUI for Java-applications before.

Jenya Pu
  • 733
  • 1
  • 7
  • 13

1 Answers1

2

Gradle subprojects

Since you are probably using gradle already, you can decouple your business model from the platform, moving them to another project, from which your android and desktop projects will depend:

  --Main Project
    |-- core
    |-- android
    |-- desktop

https://docs.gradle.org/current/userguide/multi_project_builds.html

Platform Agnostic Frameworks

If your app is using frameworks like retrofit, which work on both and Android and common java projects, you can move its usages to the core project.

GUI for desktop project

This question covers very well different GUI frameworks from where you can choose.

Keeping your MVC

Decoupling your project in such a way is not an easy task. You'll need to carefully think on how your core project will interact with the others (i.e some internal API). Basically, you will keep working on a MVC-sort-of-architecture, but now your android project will be a view, and your desktop will be another.


Similar question: java desktop and android application at the same time - shared packages


(Little bit off-topic but it might help you)

While the multi-project approach might seem like a nice reuse of existing code, it might get harder depending on how your current project is structured.

Another approach would be to use something like Electron with Polymer and/or AngularJS. If you are familiar with web technologies, it can be a lot easier to create your desktop app like this. And you have a plus: a browser app is just one step ahead. Also, Polymer keeps material design on your desktop app, making your designs more consistent between platforms, which might be difficult to achieve using native java frameworks for desktop.

Community
  • 1
  • 1
Logain
  • 4,259
  • 1
  • 23
  • 32