String inform = new String("我的信息");
firstList.add(inform);
String mon = new String("钱包");
firstList.add(mon);
String photo = new String("相册");
firstList.add(photo);
lvMy.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
String first = firstList.get(position);
switch (first.toString()){
case "我的信息" :
break;
case "钱包":
break;
case "相册":
Intent intent=new Intent();
intent.setClass(MainActivity.this,PhotoActivity.class);
startActivity(intent);
break;
default:
break;
}
}
});
first.get(position)获取的值是相应的 listview 名字。 使用first.toString(),获取get的内容。