I ‘ve been using Eclipse for Android for quite a while now. There are 2 keyboard shortcuts that i have been using lately and find very useful when coding.
The first is Auto format shortcut. This is available in editor’s right-click menu but press Ctrl + Alt + F is faster. This is a time saver. I am someone who likes to keep my code neat and tidy. I add tabs, indentation and white spaces in my code. It can be quite a hassle to code and format. With auto format, I can concentrate typing out my code and not care about formatting. Below is screenshot of my layout xml file before auto format.
After Ctrl + Alt + F, this is how it looks.
Neat right? This can be use for .java as well.
The second is automatic importing of package. Don’t have screenshot for this. Came across this when i was going through android help file example. A time save as well for someone like me who likes to try out the codes from books or webpages. I can skip typing out the import statements and jump straight to typing out the example codes. When i’m done, I press Ctrl + Alt + O and the required import statements are added. Note that this is applicable for .java files only.
Knowing such shortcuts are part of the process of learning coding through IDE. Not only does it helps increase productivity, it makes you feel good having these skills at your fingertip and share it with someone that doesn’t know about them.