views:

1306

answers:

3

I know Java apps can be run in Android. But what I want to know is this: I have a perfectly normal Java app and I want to port it to an android platform. What changes would I need to do to my app in terms of GUI and other code to make it usable in Android? I know Android uses XML file to control the look and feel of its app. So would I need to change my GUI completely?

I just want to know the general overview of how porting may be done. If anyone could point me to right resources, that would be great. Also, for your info I'm a newbie to developing android app, so please be patient with me :)

Update: Both very helpful answers. Thank you!

+2  A: 

I expect that it will be a great deal of work to do the porting, as the way that your application works with Android will be different.

You will also have some issues, perhaps, with the fact that not everything in java is supported, as it is a mobile device, but does more than JavaME.

It would help if you could explain a bit about the application, as how much it needs to interact with the user or any other resources on the device will determine how to port and how much work is involved.

Your best bet though is to see about learning to program on the Android, and there are several good books on the subject. I got one from Manning publications that I found helpful.

You may want to look at the comments in this article, as I think it would be a good starting point for you on what may need to be changed: http://www.anddev.org/problem_in_android_project_conversion-t1633.html

James Black
+3  A: 

The short answer is that you would simply rewrite all of the GUI from scratch, for Android. It simply uses a completely different UI framework. While basically all of the core Java libraries are there, Swing and AWT libraries are not.

If you are looking to translate parts of it automatically, I don't think there is any such tool. You're going to be building a brand new Android GUI.

And really, that makes sense. These frameworks are serving reasonably different platforms and needs (desktop vs. phone). You probably need to be redesigning your app quite a bit to go from a desktop to a phone.

Good news is the non-GUI parts ought to work as-is with no changes, unless they do something unusual. You may have to package third party libraries into your project if they are used by your code.

Sean Owen