• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Code Review & Advice

xerxesb

Lurker
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
 

Attachments

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.
 
Back
Top Bottom