2.创建ArrayList的Activity
3.设置从主Activity跳转到ArrayActivity
代码:
Button button=findViewById(R.id.btn1);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(MainActivity.this,ArrayListActivity.class);
startActivity(intent);
}
});
4.编写ArrayActivity的xml
代码:
<?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=“.ArrayListActivity”>
<ListView
android:id=“@+id/lv”
android:layout_width=“match_parent”
android:layout_height=“matc