The auto Complete in eclipse displays all constructors with parameters, but Android studio doesn't.
For example see the following screenshot in eclipse, it displays all constructors of Intent class.
While auto complete in android studio for Intent class is displayed without parameters as following.
How to change auto complete in android studio to display all constructors with parameters ?
Constructors can specify parameters but not return types. If a class does not define constructors, the compiler provides a default constructor (p. 83) with no parameters, and the class's instance variables are initialized to their default values.
When you declare a parameter to a method or a constructor, you provide a name for that parameter. This name is used within the method body to refer to the passed-in argument. The name of a parameter must be unique in its scope.
A Java class constructor initializes instances (objects) of that class. Typically, the constructor initializes the fields of the object that need initialization. Java constructors can also take parameters, so fields can be initialized in the object at creation time.
Copy constructors A Copy constructor has one formal parameter that is the type of the class (the parameter may be a reference to an object).
I usually start with Ctrl+P
to see what arguments are accepted (auto guess complete is way to error prone in my opinion). And if as in your case you want to fill in name type n a dropdown
menu appears with all available variables/fields
(etc) starting with n Arrow Up/Down
and Tab to select name, or Ctrl+Space
to select a method (or even Ctrl+Alt+Space
to be killed by suggestions;-), followed by , and v Tab for value.
File --> Keymap --> Main Menu --> Parameter Info --> Right Click --> Add keyboard short cut
I dont know whether it is added advantage or not while creating a constructor (ctrl+shift+space) will give default constructor after that cursor stays within the parenthesis gives all parametrized constructor of a particular class without any short cut :)
in eclipse ctrl+space with give you all the constructors of class
in android studio no need short cut key :)
You Can Use Eclipse Short Cut Keys in Android Studio Follow Below Process : File -- > Settings -- > Keymap ---> under Keymaps Drop down Select Eclipse option
Cheers
Real answer to the Question:
It is also possible to show overloaded constructors by enabling a hidden option. Invoke the Help | Find Action
menu item and type Registry
to go to the Registry. Here enable the java.completion.show.constructors
option.
Copied From: https://stackoverflow.com/a/43639241/2920861
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With