Android Development, Best Practices

Compiled by Futurice, here is the summary of what they have compiled so far:

  • Use Gradle and its recommended project structure
  • Put passwords and sensitive data in gradle.properties
  • Don’t write your own HTTP client, use Volley or Retrofit libraries
  • Use the Jackson library to parse JSON data
  • Use Volley or Retrofit+OkHttp+Picasso for networking and images
  • Avoid Guava and use only a few libraries due to the 65k method limit
  • Use Fragments to represent a UI screen
  • Use Activities just to manage Fragments
  • Layout XMLs are code, organize them well
  • Use styles to avoid duplicate attributes in layout XMLs
  • Use multiple style files to avoid a single huge one
  • Keep your colors.xml short and DRY, just define the palette
  • Also keep dimens.xml DRY, define generic constants
  • Do not make a deep hierarchy of ViewGroups
  • Avoid client-side processing for WebViews, and beware of leaks
  • Avoid testing with Robolectric on Activities, Fragments, and Views

All the details in here.


Posted

in

by

Tags:

Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from try {} except

Subscribe now to keep reading and get access to the full archive.

Continue reading