So I am studying how to build android apps by myself and I am stuck trying to understand some of the life of codes for this particular code:
package com.ebookfrenzy.javalayout; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.widget.Button; import android.widget.RelativeLayout; public class JavaLayoutActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Button myButton = new Button(this); RelativeLayout myLayout = new RelativeLayout(this); myLayout.addView(myButton); setContentView(myLayout); } }
This is to create a simple button. However, I do not under what "this" in:
Button myButton = new Button(this);
RelativeLayout myLayout = new RelativeLayout(this);
refers to, and the book does not say.