Skip to content

Instantly share code, notes, and snippets.

@Bruno125
Last active August 4, 2017 04:28
Show Gist options
  • Save Bruno125/017261ec616f2ebe06ffa7be9e46974b to your computer and use it in GitHub Desktop.
Save Bruno125/017261ec616f2ebe06ffa7be9e46974b to your computer and use it in GitHub Desktop.
Simple class with custom listener
package com.example.pack.one;
public class MyClass {
interface Listener{
void foo();
}
private Listener mListener;
public void setListener(Listener listener) {
mListener = listener;
}
public void run(){
if(mListener != null){
mListener.foo();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment