listview中OnItemClick方法各个参数的作用

时间:2023-03-08 16:55:17
listview中OnItemClick方法各个参数的作用

OnItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3)

1、arg0,arg2

m_listview.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1, int postion,long arg3) {
Intent intent = null;
switch (postion)
{
case 0:intent = new Intent(arg0.getContext(), Activity01.class);break;
case 1:intent = new Intent(arg0.getContext(), Activity01.class);break; }
startActivity(it);
}
});

2、arg1

public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
// TODO Auto-generated method stub
tv=(TextView)arg1.findViewById(R.id.textView1);
ss=tv.getText().toString();
db. delete("good", " goodname=?", new String[]{ss});