直接上代码
listView.setOnItemClickListener(new OnItemClickListener() { @Override // 第position现被单击时激发该方法 public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Map<String,Integer> map=(Map<String, Integer>) indexActivity.this.adapter.getItem(position); int spid=map.get("spid"); Toast.makeText(getApplicationContext(), "单击的是商品编号="+spid, Toast.LENGTH_LONG).show(); Intent intent = new Intent(); intent.setClass(indexActivity.this, PromessActivity.class); intent.putExtra("spid", spid); indexActivity.this.startActivity(intent); } });