答案 0 :(得分:0)
您需要执行以下操作:
//in the Activity
eventsList = new ArrayList<HashMap<String, String>>();
// selecting single ListView item
ListView lv = getListView();
// Lauching the Event details screen on selecting a single event
lv.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// getting values from selected ListItem
String ID = ((TextView) view.findViewById(R.id.pid))
.getText().toString();
Intent intent = new Intent(view.getContext(),
EventDetails.class);
intent.putExtra(pid, ID);
view.getContext().startActivity(intent);
}
});
基本上你正在做的是将列表视图中所选项目的id传递给该活动片段中的详细信息。每次选择不同的项目时,都会显示不同的详细信息。如需进一步参考,请查看this教程。