// This is the definition for a class of objects named MainActivity. Each object of this class

// contains a field named mTag and has two methods named onCreate and onDestroy.

public class MainActivity extends AppCompatActivity {

    // The following variable mTag is global because it was not created within the

    // curly braces of a method.

    String mTag = "MainActivity";


    protected void onCreate(Bundle savedInstanceState) {



        // The following instruction declares (creates) a variable named textView. The variable

        // is local because it was declared within the curly braces of a method. The variable‚Äôs

        // scope (the set of instructions where its name can be mentioned) extends from its

        // declaration to the closing curly brace that ends the method.

        TextView textView = (TextView) findViewById(R.id.textView);


        Log.d(mTag, "onCreate");



    protected void onDestroy() {


        Log.d(mTag, "onDestroy");