Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Converting Java Code to work with Android

  1. #1
    Junior Member
    Join Date
    Jul 2011
    Location
    Omaha, NE
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Converting Java Code to work with Android

    Hello,

    I am a beginner with Java in that I have worked through examples from a book. I would like to start programming android applications (simple ones). I know Android Apps use java (I can see the similarities) but words are different to some extent. Would it be effective to convert standard java code (don't know what to call this) to java code used in Android Apps (dont know what to call this)? Or should I start fresh, remember I am just starting out here? In general what changes are there. The first difference I noticed was the package declarations. I just want to know what I am getting into. Thanks in advance.
    Last edited by Farmer; May 7th, 2012 at 06:06 PM.


  2. #2
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,896
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: Converting Java Code to work with Android

    It is possible to convert some java code directly, but more often than not porting a java program to android will take significant effort, particularly when it comes to i/o and the gui interface. Packages are a part of standard java and android. The biggest differences I can see are the API's available and the execution model. Personally I would recommend getting familiar with java and general programming first before delving too deep into android.

  3. #3
    Member
    Join Date
    Jun 2011
    Posts
    56
    Thanks
    2
    Thanked 7 Times in 6 Posts

    Default Re: Converting Java Code to work with Android

    Well if you don't mix gui stuff with non-gui stuff, then you will have to change only a small part of your application.
    Java applications use Swing and Android has its own components that do similar things.
    There is not a one to one translation for the components but some are straight forward enough .
    In general Swing is more advanced than Android SDK , so if you master it you should be able to convert your app relatively easily.
    I find the layouts in android to be somewhat short, and some important components such as JTable are lacking (maybe a tablelayout will do).

    I am a _beginner_ in Android myself so here are some difficulties I encountered :
    - layouts in general
    - jtable
    - tabs (jtabbedpane is easier to handle)
    - combo-box (maybe Editbox + Spinner)
    - Jpanel (maybe be a FrameLayout will do).

Similar Threads

  1. Help with code for converting 4 digit string to integer
    By danielp1213 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: October 24th, 2011, 09:38 PM
  2. please tell me why this code does not work
    By amr in forum Java Theory & Questions
    Replies: 9
    Last Post: December 6th, 2010, 06:46 PM
  3. Converting Code to Multi Thread
    By cmill_xc in forum Threads
    Replies: 1
    Last Post: December 6th, 2010, 12:39 PM
  4. Code Stop working after converting to jar?
    By Ron6566 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: August 16th, 2010, 12:17 PM
  5. Java program to find the minimum and maximum values of input data
    By awake77 in forum What's Wrong With My Code?
    Replies: 6
    Last Post: December 20th, 2008, 05:12 PM