-3
public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        RelativeLayout myLayout=new RelativeLayout(this);
        Button myButton=new Button(this);

        myLayout.addView(myButton);
        setContentView(myLayout);

    }
rghome
  • 8,529
  • 8
  • 43
  • 62

1 Answers1

0

this refers to the object which you are calling the method. When you will create an object, suppose obj and then call obj.onCreate (), this will be a reference to obj.