android studio auto complete: how to display constructors with parameters

27,753

Solution 1

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. constructor overloads in completion

Copied From: https://stackoverflow.com/a/43639241/2920861

Solution 2

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 enter image description here

in android studio no need short cut key enter image description here:)

You Can Use Eclipse Short Cut Keys in Android Studio Follow Below Process : File -- > Settings -- > Keymap ---> under Keymaps Drop down Select Eclipse option

Cheers

Solution 3

After writing default constructor, press Ctrl+P. You will see list of possible parameters that can be fill in constructor.

Share:
27,753
Eng. Samer T
Author by

Eng. Samer T

Updated on July 18, 2022

Comments

  • Eng. Samer T
    Eng. Samer T almost 2 years

    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.

    enter image description here

    While auto complete in android studio for Intent class is displayed without parameters as following.

    enter image description here

    How to change auto complete in android studio to display all constructors with parameters ?

  • Eng. Samer T
    Eng. Samer T almost 9 years
    thanks, I appreciate you replying, however I do not want to straggle what shortcut is in a sequence of shortcuts. I ask if there is any way to make ctrl+space in android studio acts just like ctrl+space act in eclipse and display all constructors with parameters. I want to see all possibilities as options then I will choose the needed one. is it possible?
  • Daniel Hári
    Daniel Hári over 7 years
    CTRL+P wants to print!
  • Daniel Hári
    Daniel Hári over 7 years
    How it makes visible the constructors?
  • Bevor
    Bevor over 7 years
    @DanielHári Go to settings of Android Studio and change the shortcut.
  • Bevor
    Bevor over 7 years
    Thanks, although this is not an alternative, only a poor workaround. But obviously one cannot expect much from Android Studio. The original answer is here by the way: stackoverflow.com/questions/4815301/…
  • Denny
    Denny over 6 years
    Well, you got an answer for that @LynAs?
  • Roshana Pitigala
    Roshana Pitigala about 5 years
    This is awesome. Thanks!
  • Pierre
    Pierre almost 5 years
    Why isn't this enabled by default? Will make a lot of people's lives easier