1. Are you ready for the Galaxy S20? Here is everything we know so far!

Code Review & Advice

Discussion in 'Android Development' started by xerxesb, May 31, 2010.

  1. xerxesb

    xerxesb Lurker
    Thread Starter

    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:



  2. ab500

    ab500 Newbie

    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.
     
Loading...

Share This Page

Loading...