From 72c692fb6c13ff177ff669d846ee24e8f3696fd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Qiang-=E5=BF=97?= <3184528452@qq.com> Date: Sun, 17 Mar 2024 11:28:53 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MainActivity.java | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 MainActivity.java diff --git a/MainActivity.java b/MainActivity.java new file mode 100644 index 0000000..9f81b8b --- /dev/null +++ b/MainActivity.java @@ -0,0 +1,37 @@ +package com.example.meetyou; + +import androidx.appcompat.app.AppCompatActivity; + +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; + +public class MainActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main);//xml文件和java文件一一对应9, + Button button1 = (Button)findViewById(R.id.register); + button1.setOnClickListener(new View.OnClickListener() + { + @Override + public void onClick(View view) + { + Intent intent = new Intent(MainActivity.this,register.class); + startActivity(intent); + } + }); + Button button2 = (Button)findViewById(R.id.login); + button2.setOnClickListener(new View.OnClickListener() + { + @Override + public void onClick(View view) + { + Intent intent = new Intent(MainActivity.this,login.class); + startActivity(intent); + } + }); + } +} \ No newline at end of file