大学信息学院学生上机(实验)报告2024~2024学年度第2学期 课程名称:Android移动智能开发技术 2024级本科软件工程专业 班 指导老师: 学生: 学 号:一、实验名称 界面登录设计实验二、实验容(具体的程序) 1、建两个ACTIVITY,实现从界面一跳转到界面二。2、在主界面添加按钮等控件。 3、在MainActivity里写代码package .example.and;import android.os.Bundle;import android.app.Activity;import android.content.DialogInterface;import android.content.SharedPreferences;import android.content.SharedPreferences.Editor;import android.content.Intent;import android.view.Menu;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;import android.widget.CheckBox;import android.widget.CompoundButton;import android.widget.CompoundButton.OnCheckedChangeListener;import android.widget.EditText;import android.widget.Toast;public class MainActivity extends Activity {Button btn;OnClickListener lis;EditText etname;EditText etpwd;CheckBox ch1;CheckBox ch2;SharedPreferences sf ; Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btn =(Button) findViewById(R.id.btnlogin); etname = (EditText)findViewById(R.id.etname); etpwd = (EditText)findViewById(R.id.etpwd); ch1 = (CheckBox)findViewById(R.id.checkBox1); ch2 = (CheckBox)findViewById(R.id.checkBox2); sf = getSharedPreferences("my",Activity.MODE_PRIVATE); if(sf.getBoolean("ch1", false)==true) { etname.setText(sf.getString("name", "")); etpwd.setText(sf.getString("pwd", "")); ch1.setChecked(true); } if(sf.getBoolean("ch2", false)==true) { Intent intent = new Intent(MainActivity.this,SecActivity.class);startActivity(intent); } lis = new OnClickListener() {Overridepublic void onClick(View v) {// TODO Auto-generated method stubfinal String namestr = etname.getText().toString();final String pwdstr = etpwd.getText().toString();if(etname.getT...