• 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
May 31, 2010
1
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
 

Attachments

  • Calculator.java.txt
    2.8 KB · Views: 115
  • main.xml.txt
    4.5 KB · Views: 166
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.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones