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
I’ve seen many people asking how to implement Listeners in their applications. Implementing a Listener is quite easy. There are 3 ways to implement an Listener and the have their advantages and disadvantages.
The tree way to implement Listeners are
- Inline Implementation
- Using the
implementskeyword - By using variables
We’ll use our good old LoginExample application, created in previous tutorial which can be found at Android: Your first Android Application.
Continue Reading »
Implementing Listeners in your Android/Java application





