7

I'm used to write code in a such way:

private String blabla()
{
    return "bla";
}

But Android Studio is adjusted for this code:

private String blabla() {
    return "bla";
    }

Question: how can I change this option for me?

toto
  • 91
  • 2
  • 2
  • 4

4 Answers4

16

Go to File -> Settings.

Then in dialog, Editor -> Code Style -> Java -> Wrapping and Braces tab, then you can adjust braces placement

Remember to "Apply" your changes.

Corical
  • 15
  • 5
Murat Mustafin
  • 1,284
  • 10
  • 17
1

After change settings, You might formatted yours files through CTRL+ALT+L

sergeyxzc
  • 515
  • 6
  • 4
0

The accepted answer is correct. However, it seems the path may have changed just a little bit, I am using Android Studio version 3.3.2 for Windows.

The path is: File > Settings (Ctrl + Alt + S) > Editor > Code Style > Java.

Then select your relevant tab. In this case is was the Wrapping and Braces tab. I wanted to set some naming conventions the other day so I selected the Code Generation tab.

SandstormNick
  • 1,821
  • 2
  • 13
  • 24
0

In Android Studio 4.

File > Settings > Editor > Code Style > "Select the programing languae" > set Line length: 300. for example

Screenshot