How to add some methods in Motodev studio without typing it out
-
25-06-2021 - |
Question
For example, if I want to add this method:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
//some code I add later...
}
is there a way to add it without typing it all? I know that when I want the onClick method, I implement it in the class, then it shows an error, I hover my mouse over and click add unimplemeted methods, and it's there.
Solution
In Eclipse, right-click over the class, choose Source > Override/Implement Methods from the context menu, and check off the method(s) you want to add to the class.
OTHER TIPS
I know another simple way to quickly add such methods in eclipse. I think you know about intellisense - write some characters then press Ctrl + Space
. The available options will be shown in a dropdown list if there are multiple option. For single option the word will be just written.
Ok now for your case onActivityResult
. Type few characters like onActivity
then trigger intellisense. You'll see a list of few options. From there select onActivityResult
by pressing up and down key and press enter. You'll see the whole method is written down.
I do that all the time. No mouse click, just type few characters.