General Do’s and Don’ts

In this blog we are going to list some of the do’s and don’t do’s we need to keep in mind while creating an application. When the app grows it will help in refactoring and adding new features.

Do’s

  1. Always use dimensions from the dimen.xml file. Separate dimens.xml file can be created for different device screen sizes
  2. Always use strings from the strings.xml file. This will be helpful in providing localization features in our application.
  3. Always use colors from the colors.xml file.
  4. Create a custom view or create a separate view xml file and include that view in the required views. It will reduce redundancy in layout files for similar views.
  5. Always have images for multiple dimensions.
  6. Try to use vector images as much as possible. As it can resize automatically based on the screen sizes.
  7. Follow naming conventions for variables, functions and classes.
  8. Check Lint for warning and error messages.

Don’t do’s

  1. Hard coding dimensions in the xml file.
  2. Hard coding string in the xml file.
  3. Hard coding colors in the xml file.
  4. Creating redundant views in xml file.

These are some of the basic things we need to keep in mind. Feel free to list out anything you think should be there in the list in the comments section.

Happy learning
Team Appmetry

Leave a Reply