Code Review & Advice


Last Updated:

  1. xerxesb

    xerxesb New Member This Topic's Starter

    Joined:
    May 31, 2010
    Messages:
    1
    Likes Received:
    0
    Hi guys,

    I'm a seasoned C#/.NET dev slowly peeking my head into the Java world through Android.

    I've written a really small calculator app as my first project, and wanted to get some feedback from other devs regarding Java/Android coding style, standards, and techniques (particularly working with strings).

    I've attached the java source and the layout file for the main activity - was hoping someone (or many) could give some feedback.

    It wasn't intended to be a scalable/maintainable solution, but any advice would still be appreciated :)

    Cheers
     

    Attached Files:


    Advertisement
  2. ab500

    ab500 Active Member

    Joined:
    May 21, 2010
    Messages:
    37
    Likes Received:
    17
    Hello,

    I'm a fellow .Neter wondering into the Java world.

    The whole string casting stuff always makes me cringe, however your only alternative is creating a derived button class to hold an integer or use a dictionary to lookup. I took a quick look through the Android reference and didn't see anything that would let one tag a button with an arbitrary object.

    Outside of that it's bad practice to store working variables in GUI elements like it appears you're doing with the currently calculated value.

    Actual Java code looks decent, I'm still learning best practices though.
     

Share This Page

Loading...