Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android studio : leave my one-line methods as i've typed them when reformating code

Is there an option in android studio to leave one-line method when reformatting code ? For example, for a simple getter, i prefer this style of coding:

public int getPosition() {return mPosition;}

But, when i reformat the code, this method is changed like this:

public int getPosition() {
    return mPosition;
 }
like image 205
coutier eric Avatar asked Oct 09 '15 20:10

coutier eric


1 Answers

Finally, I've found the solution.

  1. Go to File > Settings > Editor > Code Style > Java
  2. Click the Wrapping and Braces tab
  3. Find the Keep when reformatting section
  4. Turn on the Simple methods in one line checkbox

And it just go fine!

like image 120
coutier eric Avatar answered Oct 12 '22 23:10

coutier eric