How to auto generate comments for your android functions – Android Studio

If you want to write comments for your android functions, there is an easy way to auto generate the basic comment skeleton in Android Studio.

First define you function with all the necessary parameters and a return value. Then keep the cursor above the function, type /** and press Enter key. You can see the required will be generate above your function.

1. Define your function.

private boolean shouldGenerateAutoComments(String title, boolean isValid, List<String> listNames){
        // function code
        return true;
}

2. Place the cursor above the function, type /** and press Enter.

/**
     * 
     * @param title
     * @param isValid
     * @param listNames
     * @return
     */
    private boolean shouldGenerateAutoComments(String title, boolean isValid, List<String> listNames){
        // function code
        return true;
    }