我想顯示在另一活動的一個列表視圖中輸入的所有值,並且在單擊該按鈕後在單行以前活動的文本視圖顯示如何將列表視圖中的所有值傳遞到單行中另一個活動的文本視圖
這裏是我的代碼添加到列表視圖:
public class AddAttendees extends Activity{
AutoCompleteTextView et;
Button b, Add;
ListView lv;
ArrayList<String> al;
ArrayAdapter<String> aa;
int position;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.attendees);
Add = (Button) findViewById(R.id.button2);
et = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextView1);
b = (Button) findViewById(R.id.button1);
lv = (ListView) findViewById(R.id.listView1);
al = new ArrayList<String>();
aa = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1,
al);
lv.setAdapter(aa);
lv.setOnItemClickListener(new OnItemClickListener() {
@SuppressLint("ShowToast")
@Override
public void onItemClick(AdapterView<?> parent,
View v, int arg2,
long arg3) {
String item = al.get(arg2);
Toast.makeText(getApplicationContext(), item, 0).show();
}
});
b.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
String item = et.getText().toString();
al.add(0, item);
aa.notifyDataSetChanged();
et.setText("");
}
});
Add.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v){
Intent intent = new Intent(getApplicationContext(), MeetingAgenda.class);
String name = al.getText().toString();
intent.putExtra("name", name);
/* Start LoginSuccess Activity */
finish();
}
});
}
}
後點擊添加按鈕的項目添加到列表視圖將顯示在這TextView的在之前的活動。
到目前爲止你有嘗試過什麼嗎? – PPartisan
看到如何問:http://stackoverflow.com/help/how-to-ask –