| 1 | package com.example.bazel; |
| 2 | |
| 3 | import android.app.Activity; |
| 4 | import android.os.Bundle; |
| 5 | import android.util.Log; |
| 6 | import android.widget.Button; |
| 7 | import android.widget.TextView; |
| 8 | |
| 9 | /** |
| 10 | * Main class for the Bazel Android "Hello, World" app. |
| 11 | */ |
| 12 | public class MainActivity extends Activity { |
| 13 | @Override |
| 14 | public void onCreate(Bundle savedInstanceState) { |
| 15 | super.onCreate(savedInstanceState); |
| 16 | Log.v("Bazel", "Hello, Android"); |
| 17 | |
| 18 | setContentView(R.layout.activity_main); |
| 19 | |
| 20 | Button clickMeButton = findViewById(R.id.clickMeButton); |
| 21 | TextView helloBazelTextView = findViewById(R.id.helloBazelTextView); |
| 22 | |
| 23 | Greeter greeter = new Greeter(); |
| 24 | |
| 25 | // Bazel supports Java 8 language features like lambdas! |
| 26 | clickMeButton.setOnClickListener(v -> helloBazelTextView.setText(greeter.sayHello())); |
| 27 | } |
| 28 | } |