I have typed code in Java for Android in Eclipse. The formatting is not nice. Is there any way I can automatically format it using keyboard shortcuts? Any help will be highly regarded...
9 Answers
Press [Ctrl]+[Shift]+F to auto format the java code in Eclipse.

- 698
- 7
- 26

- 703
- 7
- 20
Press ctrl + A and then ctrl + I and as well as you can press ctrl+ shift+ F for formatting code in Eclipse.

- 41
- 2
//Right click your project and select
Source -> Format
this will format your whole project
same way if your do organize your imports it will good.
Source -> Organize Imports [Ctrl+ Shift +o]

- 19,893
- 17
- 73
- 130
Press ctrl + A
and then ctrl + I
and as well as you can press ctrl+ shift+ F
for formatting code in Eclipse.

- 4,352
- 3
- 21
- 41
-
ctrl + A is not necessary . – Sujith PS Dec 18 '13 at 09:00
You should really have a look at
Eclipse in that Window > Preferences > Keys .
You can find all of the shortcuts there and you can also define you own shortcuts you want.
And you can also set you formatter to custom format the you want to format your code in
Window > Preferences > Java > Code Style.
And AS YOU KNOW.
ctrl + shift + f is the autoformat shortcut

- 989
- 6
- 15