Best way to implement View.OnClickListener in android

后端 未结 14 2411
盖世英雄少女心
盖世英雄少女心 2020-11-27 05:25

Suppose we have an Activity with a lot of views on which OnClickListener is to be registered.

The most common way to implement this is to let the Activi

14条回答
  •  粉色の甜心
    2020-11-27 06:20

    First approach is better than the other because thats why View.OnClickListener is an Interface instead of an abstract class. besides the later might leak in various situations since you are using a non-static inner class.

提交回复
热议问题