How to automatically generate getter and setter for android studio

Hi y'all. I just wanted to share something that is truly a life saver for programmer like, me. As mentioned in my previous post, I currently stuck around with coding everyday. Today, during a short discussion with my supervisor and another colleague, supervisor mentioned that:

"Do you guys know that in eclipse and android there is a shortcut to generate the getter and setter? You guys do not have to type by yourself. But i couldn't remember it now. Later i will share to you guys okay."

Then I was like so curious about what is it about because I had never do research on that ever since i started doing android java coding. So, not so long after the discussion ended, I decided to clear my doubt. I googled and I got my answer!

HERE IS THE LIFE SAVIOUR TIPS:
Windows: Alt+Insert

Mac OSX: Cmd+N


After the shortcut, a dialog Generate will drop down and this is what you will see, choose what you need. To my surprise, there are quite some useful one! 


Then you will link to this one and you can choose one or use shift or ctrl to select more than one then click ok.




Tadah, here is the result! So amazing and eyes opening.



I had tested both and it's working. 100%. I am definitely not a shortcut freak but this one really save my time unless you are stress over stuff and decides to spend some spare time to type it yourself. Happy shortcut.

**add on: One more useful tip for me about shortcut for android studio is, move the cursor to last edit location. (shift+ctrl+backspace for windows) Beware that it only will move back to last EDITED location only. If you only move the cursor around without edit, it will not work. Happy trying. 

Love Stacy. Happy shortcut. Happy life.

Comments

Popular posts from this blog

What I eat in Kuching

无影的压力