-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainActivity.Java
More file actions
38 lines (28 loc) · 1002 Bytes
/
MainActivity.Java
File metadata and controls
38 lines (28 loc) · 1002 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.example.java1;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
TextView theTxt;
Button btn_Button;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
theTxt = (TextView) findViewById(R.id.textView2);
btn_Button = (Button) findViewById(R.id.button1);
//Change the button text
Button button_btn = (Button)findViewById(R.id.button1);
button_btn.setText("Click me");
//set the text to uppercase & or .toLowerCase (if there is)
btn_Button.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v)
{
theTxt.setText("tanttax".toUpperCase());
}
});
}
}