How do you add an argument to the existing designer?



  • Is there a combination of keyboards or other solutions to add a new argument to an existing automatically-generated designer?

    public class prim {
    int a;
    int b;
    

    public prim(int a) {
    this.a = a;

    }
    }

    The simplest example is, is it possible to add, without removing the old designer, int b?
    To be like this:

    public class prim {
    int a;
    int b;

    public prim(int a, int b) {
    this.a = a;
    this.b = b;
    }
    }



  • For addition private The field in the existing designer needs to be given a mouse the name of this field, press it. Alt+Enter and choose add constructor parametr

    That's right. AndroidStudio and IDEA and only if the field is declared as private


    Also, according to this. https://www.jetbrains.com/idea/help/generating-constructors.html for use Alt + Insert and choose constructor♪ This is how a new designer will be created.

    P. S. The same question en-SO: https://stackoverflow.com/questions/34692945/shortcut-for-adding-class-field-to-existing-constructor-in-androidstudio-or-idea/34692946#34692946




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2