Peter
Peter

Reputation: 5121

How to convert a java swing application to work on android

So I built a program in Java using swing for the interface and i didn't realize how difficult it would be to convert it to be used as an android application. Is there any way for me to easily convert or rebuilt the program to be sold in the android market place? If not can anyone point me toward any resources to help build a android.

Upvotes: 25

Views: 63595

Answers (5)

Austine Gwa
Austine Gwa

Reputation: 812

swing UI was meant for desktops and pc's but for android you have to use Xml then you can keep your java codes as they are in the various activities then use your event handling skills to trigger them

Upvotes: 1

Brandon Wilson
Brandon Wilson

Reputation: 4590

I did the same thing awhile back. Although there is no program out there that I know of to convert it directly. The Java code and the android code are very similar. Since android doesn't use swing's UI it uses XML based UI. once you get the UI functions of the android app down your Java code can be easily imported.

I am working on converting my Java app into an android app now. Most of my classes imported with no problem.

Upvotes: 15

user646481
user646481

Reputation:

What I would do is that I would build the UI in XML, then I give the items an ID and reference to it in Java, and then I'll trigger everything by button clicks so what one button does in your swing layout does the same on android. You can't copy/paste it.

Upvotes: 2

kieu vuong
kieu vuong

Reputation: 9

  • Open the project's properties

  • Select Java Build Path

  • Select Libraries tab

From there you can Add External Jars and you can use swing layout

Upvotes: -11

Alexander Ponomarenko
Alexander Ponomarenko

Reputation: 559

AjaxSwing allows to convert Swing applications and use them directly on android or ipad, see http://www.creamtec.com/products/ajaxswing/solutions/java_swing_ui_on_ipad.html

Upvotes: 7

Related Questions