Copy intellij-java-google-style.xml into the directory $HOME/Library/Preferences/IdeaIC14/codestyles/.
Copy intellij-java-google-style.xml into the directory $HOME/Library/Preferences/IdeaIC14/codestyles/.
In the latest Android Studio (as of this edit, 4.1.1) you can go to Preferences -> Editor -> Code Style -> Scheme -> Settings Icon (Gear) -> Import Scheme... and import the xml there.
Export at home:
File > Export Settings > Select which settings you want to export
Import anywhere else:
File > Import Settings > Browse to the exported file
If you already have a code style you want to import the accepted solution doesn't really help you. Steps to add an existing XML profile (Windows):
1) Open C:\users[you].AndroidStudio[2.3]\config
2) If it doesn't already exist, create a directory "codestyles"
3) Restart Android Studio
4) Open File->Settings->Editor->Code Style. The new profile will appear in the list.
To change formatter options go to File | Settings | Code Style | Java
To reformat your code manually, press Ctrl + Alt + L (or using the menu Code | Reformat code...). To reformat the whole source code of your module, just select the module folder first.
More information about reformating source code can be found on the IntelliJ Web Help
In Android Studio 3.3.2 (running in Mac OS) "Android Studio" -> "Preferences" -> "Editor" -> "Code Style" -> "Java".
I would be useful to find a way to export/import only code format settings in order to share them between the team.
You can download the development repo from Android source. The development/ide/intellij folder includes code style, templates...
Instructions to use Eclipse XML formatter in Android Studio:
- File -> Settings -> Plugins
- click 'Browse repositories' button, enter 'Eclipse Code Formatter' in the search field and install the plugin.
- Restart Android Studio.
- File -> Settings -> Other Settings -> Eclipse Code Formatter (if you cannot find it, then use search field for that)
- select 'Use the Eclipse code formatter', browse your xml style file and press OK button to close the Settings.
I hope I wrote instructions clear. Let me know in case you didn't understand.
I've done quite a lot of researches, but in the end, I haven't reached a very satisfying answer: probably it's just a code style for IntelliJ.
The first thing I did was trying to compare the IntelliJ style with something else, but I always found some differences.
It doesn't follow Google's style because they don't fully qualify import, in fact, IntelliJ will try to unify imports by putting *, like writing import foo.*; instead of import foo.Bar;.
It doesn't follow Oracle's guidelines either since the switch statement is formatted in a different way:
switch (condition) {
case IDEA:
statements;
break;
case ORACLE:
statements;
break;
}
At this point, I've started looking for something else, but found even less. In fact, IntelliJ doesn't tell about the code style used in their software anywhere. Instead, they just explain how to change it.
Moreover, there are plugins for every possible code style! If one of them was the actual style in IDEA a plugin shouldn't be needed...
To make things worse, even for Kotlin, a language created by IntelliJ, they differentiate between "Kotlin Coding Conventions" and "IntelliJ IDEA default code style".
What I think is that they made a code style that works for most languages supported by their IDEs with little differences, and this is what Android Studio ended up using by default.
Android Studio code styles are based on IntelliJ Idea code styles. You can refer this link to know more about code styles in IntelliJ Idea
Code Style Java
Also you can refer this link to customise your code styles,
Android Studio Code Style
There is a good description of code style rules here.
If you want to enforce this rules without remembering all of them, and you are using eclipse then you can use formatting rules provided by Android team: android-formatting.xml. Just import it into eclipse using Preferences->Java->Code Style->Formatter, click Import.
There is a ton of information available here: http://source.android.com/source/code-style.html
If any package is having more than N numbers of import of the same package in Android studio, it automatically converts it to * imports for that package (default are 5 for Top-level Symbols and 3 for Java Statics and Enum Members).
So, for example if you're having some N number of imports from package java.util, it gets converted to java.util.*.
Where to find that setting to change it?
Open Settings from File-> Settings in Android Studio (ctrl+alt+s).
Go to Editor -> Code Style -> Java/Kotlin and open imports tab then change that N number to any of your suitable case.

There are other options available as well.
From Intellij official documentation
When the number of classes that IntelliJ IDEA has imported from the same package reaches the limit (5 by default), the IDE modifies the statements in order to import the entire package instead of importing several single classes from this package.
You can disable this feature like following.
In the Settings/Preferences dialog (
Ctrl+Alt+S), select Code Style | Java | Imports.Make sure that the Use single class import option is enabled.
In the Class count to use import with ‘*’ and Names count to use static import with ‘*’ fields, specify values that definitely exceed the number of classes in a package and the number of names in a class (for example, 999).