问题描述:

Usually, I assign button click handler as follows-

//activity_main.xml

<Button android:onClick="DoWork" />

//MainActivity.java

public void DoWork(View view){}

Now, I have got a ListView which click event handler is as the following-

protected void onCreate(Bundle savedInstanceState) {

final ListView listView = (ListView) findViewById(R.id.CategoryListView);

listView.setOnItemClickListener(new AdapterView.OnItemClickListener()

{

public void onItemClick(AdapterView<?> arg0, View v, int position, long id)

{

}

});

}

If I would like to do <ListView android:onClick="Something"/> , how should I define the method?

Sorry if this is a foolish question. Thank you.

相关阅读:
Top