android developer tips and tricks
android developer tips and tricks are the collections of tips which can save your lot of times. If you are spending lots of time in programming you must check out all android tips to improve your performance and result.
Android Programming Tip 1: Use Comments
You need to add comments in code so you can jump letter with Edit >> Find >> Find in Path (Ctrl + Shift + F)
Android Programming Tip 2: Generate Getter Setter Easily
If you have created the class for which you need getter setter then you don’t need to create it manually, steps to generate getter setter in android is Select your variable name and right click, select Generate (Alter + Insert), Select Getter and Setter to Generate it easily.
Android Programming Tip 3: Add Try Catch Block Automatically
Want to add few statements into try catch block then its very easy in the android studio, select your statements and press Ctrl + Alt + T to open surround with options select try catch and your statements will be surrounded with try catch in android studio automatically.
Android Programming Tip 4: Arrange your code with proper indentation
Want to add proper indentation and want to arrange code automatically in proper format then select your code and goto Code >> Reformat code (Ctrl + Alt + L) and Code >> Rearrange Code
Android Programming Tip 5: Fetch Sample Code from Google from Android Studio
Want to check out sample code of the classes you have written Its very easy, Select super class name ( eg. AppCompactActivity) and right-click on it and click on Find Sample Code or press Alt + F8
Android Programming Tip 6: Jump to View or File Easily
Press Ctrl and move your mouse pointer you will find Hyperlink click on it to move to File / View.
Android Programming Tip 7: Search File Name / Switching File
Goto Project Window Select Android Option from Top, Click on App Press * Two Times to expand your files and type file name and press enter.
Android Programming Tip 8: Want to find a similar method in all files.
If you have written Intent i and want to find out how many files you have written Intent i then select FindUsage to find similar code in your project. Can help to locate similar code easily.
Android Programming Tip 9: Remove Unused Imports
Its very easy to remove unused import in android studio, Press Ctrl + Alt + O. Even you can select multiple files and press Ctrl + Alt + O
Android Programming Tip 10: Remove Unused Resources
Its very easy to locate and remove unused resources in the android project, Refactor >> Unused Resource and Click on Preview to View Unused Resource.