我已经搜索了很多问题,但我没有得到具体的答案。
public class Addpeople extends Activity implements OnClickListener
{
public String name ;
public String age;
public String sport;
EditText etName;
EditText etAge;
Spinner spinner;
Button Add;
Button Done;
ArrayList<String[]> arryList=new ArrayList<String[]>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_addpeople);
spinner = (Spinner) findViewById(R.id.spinner1);
etName= (EditText) findViewById(R.id.editText1);
etAge= (EditText) findViewById(R.id.editText2);
Add=(Button) findViewById(R.id.bAdd);
Done=(Button) findViewById(R.id.bExit);
Add.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
name = etName.getText().toString();
age = etAge.getText().toString();
sport =spinner.getSelectedItem().toString();
arryList.add(name);
arryList.add(age);
arryList.add(sport);
}
});
`