In Android Studio you can add regions using the steps below
- Open the IDE you are using
- Select the code you want to group
- Press Ctrl + Alt + T (Cmd + Opt + T for mac) and select the “region .. end region comments”
- Now the code is surrounded with “//region” / “//endregion” lines, you can see that the region can be fold-able
- You can now edit the description of your group
- You can easily see the code within your group without having to expand the group, just hover the group description with the mouse pointer
See this