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

1

11

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;
 }
Adao answered 9/10, 2015 at 20:34 Comment(0)
A
19

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!

Adao answered 13/10, 2015 at 13:30 Comment(1)
Kudos for giving the solution to your own problem. ("Nervermind I found a solution.")Leafy

© 2022 - 2024 — McMap. All rights reserved.