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.
- Always use dimensions from the dimen.xml file. Separate dimens.xml file can be created for different device screen sizes
- Always use strings from the strings.xml file. This will be helpful in providing localization features in our application.
- Always use colors from the colors.xml file.
- 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.
- Always have images for multiple dimensions.
- Try to use vector images as much as possible. As it can resize automatically based on the screen sizes.
- Follow naming conventions for variables, functions and classes.
- Check Lint for warning and error messages.
- Hard coding dimensions in the xml file.
- Hard coding string in the xml file.
- Hard coding colors in the xml file.
- 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.