• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Java on Android - Most common errors and pitfalls?

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jeff:

What do you find are the most common errors that Java programmers make, when first beginning Android development?

What kinds of misunderstandings did you yourself have, and what assumptions did you make (and later find to be untrue) for coding in Java on Android?

These could be syntactical errors, environmental problems, functional differences between the JVM implementations, unnecessary over-coding because of available Android-specific functionality...

Not so much a "best practices" question... more like "what to avoid doing" (because it's unnecessary or doesn't work the same in Android Java)...

thanks and regards,
=Chuck Staples
 
author
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Chuck,

I think that the most common errors probably involve not coding an activity's lifecycle methods correctly, not following best practices so that activity user interfaces look good on any Android device, and forgetting to specify some necessary item in the AndroidManifest.xml file. I point these out because activities have a complex lifecycle and there are certain variations on that lifecycle (as pointed out by Google's Dan Morrill in his Inside the Android Application Framework video), Android screens have different sizes and an image that looks good on one screen might need to be scaled up for a bigger screen (and looks terrible as a result), and the AndroidManifest.xml file contains alot of options and it takes time to learn about them.

I've found no language-oriented problems in Android, except for one possibility: enums. An enum is a Java class and each constant is an instance of that class. I recall reading (but cannot remember the source, unfortunately) that using enums in Android is not good because of memory footprint, class loading, and so on. This doesn't make too much sense to me at the moment, so I'm planning to locate this information and blog about it on my website in the near future.

All the best.

Jeff



 
reply
    Bookmark Topic Watch Topic
  • New Topic