package com.example.myapplication; import androidx.appcompat.app.AppCompatActivity; import android.annotation.SuppressLint; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; public class statistics extends AppCompatActivity { private DBOpenHelper1 dbOpenHelper1; private EditText et_DaKa_studentID; @SuppressLint("MissingInflatedId") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_statistics); Button btn_Check_student=(Button)findViewById(R.id.btn_Check_student); et_DaKa_studentID=findViewById(R.id.et_DaKa_studentID); dbOpenHelper1=new DBOpenHelper1(statistics.this,"dakaData.db",null,1); btn_Check_student.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String studentID=et_DaKa_studentID.getText().toString(); int arr1[]=new int[10]; arr1=dbOpenHelper1.chaxunid(studentID,dbOpenHelper1.getReadableDatabase()); Bundle b=new Bundle(); b.putIntArray("arr",arr1); Intent intent= new Intent(statistics.this,ShowStatistic.class); intent.putExtras(b); startActivity(intent); statistics.this.finish(); } }); } } <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".statistics" android:orientation="vertical" > <EditText android:id="@+id/et_DaKa_studentID" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="请输入需要查询的学生学号" android:layout_marginLeft="20dp" android:layout_marginRight="20dp" android:layout_marginTop="200dp"/> <Button android:id="@+id/btn_Check_student" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="一键查询" android:layout_marginLeft="20dp" android:layout_marginRight="20dp" android:layout_marginTop="20dp" /> </LinearLayout>
标签:总结,studentID,16,et,2023.3,statistics,new,import,android From: https://www.cnblogs.com/wllovelmbforever/p/17224305.html