CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2010
    Posts
    12

    Stupid Java question

    Hi,

    Before I start learning Java I just wanted to know one thing, if I write a "basic" Java app will it work on ALL Java enabled phones? as I have been reading there appears to be lots of flavours of Java SDK's some for Nokia phones some for Sanyo etc etc. I just want to create a calculator app and be confident it will work on 90% of phones.

    Thanks and sorry for being a newbie

  2. #2
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: Stupid Java question

    I've not done any Java Mobile coding but I can tell you the reason there are different sdk's for different phones is the same reason there are different sdk's for different PC operating systems/platforms. Each OS/platform has to have a dedicated JVM written for it as the JVM has to be able to interact with the OS but they will all run the same Java code without it having to be recompiled for the different JVM's.

    This, of course, only applies to code written purely in Java. If you use platform specific features then your code will obviously no longer be portable.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  3. #3
    Join Date
    May 2009
    Posts
    19

    Re: Stupid Java question

    Most mobile phone development requires you to use at least some platform-specific functionality, mostly because applications on phones are run differently due to the memory limitations. At least, that's true for android OS apps. However, if its a calculator program, you'll also need graphics, which will almost definitely need platform-specific coding.

    In fact, Java coding for mobile devices is quite difficult. If you want to learn how, you'd probably be best off writing apps for desktop/laptop computers, then moving to phones/mobile devices. Not necessarily a large number of programs - even a simple one that covers the syntax and structure of Java programs would be enough (that includes knowing what keywords do what, interfaces, classes, and enums)

    To write mobile apps, you might want to start with Android apps. They're portable to quite a few different phone brands, and the Android OS is well developed.

  4. #4
    Join Date
    Mar 2010
    Posts
    12

    Re: Stupid Java question

    Thanks for the replies, OK I understand why currently we need specific flavours for each mobile but on the flip side why can very simple functions not be carried across every platform

    e.g.

    screenWidth= display.size.width
    screenHeight = display.size.Height

    MyButton as New display.button.small
    MyText as New display.TextEdit(20,screenHeight / 2)

    I am sure this could be done and made device independent small is defined by the manufacturer as is basic font size, if edit box with 20 chars cannot be created raise a error.

    This would allow very basic cross platform app to be created and I suspect even quite complex ones.

    Steve

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured