When working on an Android project, you may encounter extremely large files containing a variety of variables and methods. Some methods may be relevant to one use case while others may be relevant to another.
Assume you have a Utility file that has the following methods with huge method bodies.
When working on an Android project, you may encounter extremely large files containing a variety of variables and methods. Some methods may be relevant to one use case while others may be relevant to another.
Assume you have a Utility file that has the following methods with huge method bodies.
You could categories them by use case, but you’ll still have to scroll through them. For example, if you need to update networkUtility2() method, you’ll have to navigate through all the other methods, which takes time.
Meet Custom Code Folding
Custom Code Folding allows you to specify your own code-folding regions using special line comments.
To use custom code folding,
1. Select and highlight the code block to be folded.
2. Now, press Ctrl+Alt+T to get `surround with` action menu.
3. Select `region..endregion Comments` option
5. Move the caret (cursor) to the description and hit Ctrl + – (Minus).
Your code will be folded between regions, which will look pretty nicely, as shown below.