如何在后台获取前台按钮的结果,和如何获取前台文本输入框的结果和提示框。
on_user=findViewById(R.id.on_user); on_password=findViewById(R.id.on_password); on_juese=findViewById(R.id.on_juese); on_juese.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup radioGroup, int i) { if(i==R.id.student) juese="student"; if(i==R.id.techer) juese="teacehr"; } }); btn1=findViewById(R.id.haveoning); btn1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent=new Intent(MainActivity.this,Zhuce.class); startActivity(intent); } }); btn2=findViewById(R.id.oning); btn2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String shuow=on_user.getText().toString()+on_password.getText().toString()+juese; Toast.makeText(MainActivity.this,shuow,Toast.LENGTH_LONG).show(); } }); } id=findViewById(R.id.haveoning_id); name=findViewById(R.id.haveoning_name); phonenumber=findViewById(R.id.haveoning_phonenumber); flat=findViewById(R.id.haveoning_flat); password=findViewById(R.id.haveoning_password); aginpassword=findViewById(R.id.haveoning_aginpassword); submit=findViewById(R.id.haveoning_submit); submit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if(!password.getText().toString().equals(aginpassword.getText().toString())){ Toast.makeText(Zhuce.this,"密码不正确!!!",Toast.LENGTH_LONG).show(); } else{ //kaishizhuce Sql_one add=new Sql_one(); try { add.Zhuce(id.getText().toString(),name.getText().toString(),phonenumber.getText().toString(),flat.getText().toString(),password.getText().toString()); } catch (Exception e) { throw new RuntimeException(e); } //jiehsuzhuce } } });
标签:总结,findViewById,每日,getText,toString,new,23.3,haveoning,id From: https://www.cnblogs.com/laobing6214/p/17189211.html