Android setOnclicklistener parameter

后端 未结 6 1579
忘了有多久
忘了有多久 2021-02-06 07:58

I\'m a beginner to android, while setting onclick listener to a button, what does the parameter passed mean:

 btn1.setOnClickListener(new OnClickListener() {

         


        
6条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-06 08:07

    OnClickListener()

    is an interface. With the new keyword you are declaring a new object of an anonymous inner class that will implements the interface. That s base question for

    java

    than android. You should consider reading about

    java interface

提交回复
热议问题