Tseng’s dev blog

A developers blog




How to implement your own Listener in Android/Java

Tuesday 17 February 2009 @ 8:31 pm

When you’re developing application, there is often a need to create your own controls/widgets/classes or to extend already available ones. And in most cases, you want this control/widget to be as flexible as possible. In order to achieve this, you have to create special events, which can be handled outside of your widget.

Some of the popular examples are OnClickListener and OnKeyListener. But sometimes you need Events/Listener which aren’t predefined by the Java or Android SDK. In this case, you have to create your own Listener interface.

In the last post, I’ve shown three different way on how to implement Listeners in your application. Now I’ll show you how to implement your own Listeners.

Continue Reading »
How to implement your own Listener in Android/Java

Bookmark and Share