一:
二
1:
public void selectName(View view){Intent intent = new Intent(this,NameListActivity.class);startActivityForResult(intent, 1);}public void selectName2(View view){Intent intent = new Intent(this,NameListActivity.class);startActivityForResult(intent, 2);}
lv_name.setOnItemClickListener(new OnItemClickListener(){public void onItemClick(AdapterView<?> parent, View view,int position, long id) {String clickedName = names[position];Toast.makeText(getApplicationContext(), clickedName, 0).show();Intent data = new Intent();data.putExtra("clickedName", clickedName);setResult(0,data);finish();}});
protected void onActivityResult(int requestCode, int resultCode, Intent data) {super.onActivityResult(requestCode, resultCode, data);if(data!=null){String name = data.getStringExtra("clickedName");if(requestCode == 1)et_name.setText(name);if(requestCode == 2)et_name2.setText(name);}}