• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java on Android - Most common errors and pitfalls?  RSS feed

 
Chuck Staples
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • 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
 
Jeff Friesen
author
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • 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



 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!