Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>With many quick fixes, there is a side menu option to "Fix all xyz problems in file". This is however not available when fixing a "Cannot resolve symbol 'foo'" error since there are multiple ways to solve such an issue (i.e. add a field, a local variable, a parameter, etc.)</p> <p><strong>The fastest way would be to auto generate the names and fields as you write the code.</strong> This also has the advantage that when you use a variable name suggested by IDEA, you save even more keystrokes. Moreover, those variables/fields are immediately available for code completion.</p> <p>For example, for the first item you show, I would do the following:</p> <ol> <li>Type: <code>(TextView) findViewById(R.id.yourNick);</code><br> <ul> <li>Notice there is no leading variable/field name or <code>=</code> sign</li> </ul></li> <li>With the cursor still at then end of the line (i.e. to the right of the closing <code>;</code>) Use the <em>Introduce Field</em> (<kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>F</kbd>) action.</li> <li>Either select one of the suggested names or type a name, and hit <kbd>Enter</kbd></li> </ol> <p>The cursor ends where it was (i.e. the end of the line), so you can just type <kbd>Enter</kbd> and continue coding the next line. This methodology adds only a single key stroke (<kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>F</kbd>), but eliminates typing of the <code>=</code> and 2 spaces (so you are ahead 2 keystrokes). And it can eliminate typing the variable/field name if one of the suggestions is useable (which is very often is).</p> <p>The same works for local variable names (<kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>V</kbd>), "constants" (<kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>C</kbd>), and parameters (<kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>P</kbd>)</p> <p>I use this methodology constantly. I can't remember the last time I have ever manually started a line of code with a variable declaration.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload