Sonntag, 5. Juni 2011

Best Practise for naming

Derrived from the IOSched application and from discussions with Novoda:
  • Use package names .ui.tablet, .ui.phone, .ui.widget accordingly
  • Use package .provider for classes related to content provider
  • Use prefix activity, fragment for layout files accordingly
  • Use same name for id and text of views in layout files
  • Use postfix Activity, Fragment in pacakge .ui and Contract, ProviderDatabase in package .provider
  • Use prefix m for class fields (to indicate that is a member of the class - no need to use this anymore)

2 Kommentare:

  1. There are more guidelines for the Android Open Source Project at http://source.android.com/source/code-style.html#follow-field-naming-conventions
    but they are note Android specific, just general coding guuidelines.

    AntwortenLöschen
  2. * Use type_layout_name, e.g. button_main_ok as IDs in layout files.

    AntwortenLöschen