开发者

Define onClick Events In Another Class

Hello :) I have several classes which call the onItemClick event of the same ListView and there is quite a lot of code inside each one, and all the 开发者_如何转开发code is the same. I've seen other people define the onClick event in another class, how would i go about doing this?

Any examples or tutorials would be much appreciated. Thanks


I think what jpm mean was "implement":

public class Blah implements OnItemClickListener {
    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
      //do stuff!

    }
  }


Define a class which extends OnItemClickListener do the stuff you want to do in its onItemClick method and set this listener as the lisviews onItemClickListener...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜