The import androidx. Appcompat. App. AppCompatActivity;
The import android. OS. Bundle;
The import android. View. The view;
The import android. Widget. The Button;
The import android. Widget. TextView;
Public class MainActivity extends AppCompatActivity {
The Button button4, button17 button3, button2, Button, button8, button7, button5, button6,
Button12 button11, button10 button9, button16, button15, button14, button13;
TextView editText;
@ Override
Protected void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button4=the findViewById (R.i db utton4);//established a link between two
Button17=the findViewById (R.i db utton17);
Button3=the findViewById (R.i db utton3);
Button2=the findViewById (R.i db utton2);
Button8=the findViewById (R.i db utton8);
Button7=the findViewById (R.i db utton7);
Button5=the findViewById (R.i db utton5);
Button6=the findViewById (R.i db utton6);
Button12=the findViewById (R.i db utton12);
Button11=the findViewById (R.i db utton11);
Button10=the findViewById (R.i db utton10);
Button9=the findViewById (R.i db utton9);
Button16=the findViewById (R.i db utton16);
Button15=the findViewById (R.i db utton15);
Button14=the findViewById (R.i db utton14);
Button13=the findViewById (R.i db utton13);
//button4. SetText (" 7 ");//run it becomes seven
The editText=the findViewById (R.i d.e ditText);
Button4. SetOnClickListener (new View. An OnClickListener () {//button listener
@ Override
Public void onClick (View v) {
//button4. SetText (" 7 ");//when click to turn the seven
EditText. SetText (editText. GetText () + "7");
}
});
Button17. SetOnClickListener (new View. An OnClickListener () {
@ Override
Public void onClick (View v) {
The editText. SetText (" ");
}
});
Button3. SetOnClickListener (new View. An OnClickListener () {//button listener
@ Override
Public void onClick (View v) {
CodePudding user response:
You first look at logcat log, there is what you wantCodePudding user response: