Extension of my comment above:
You need to register the mListener
somehow. A pattern to do this is:
public class MyHandler {
private LoginListener mListener;
public MyHandler(LoginListener listener) {
mListener = listener;
}
// ... etc...
}
Where LoginListener
is:
public interface LoginListener {
public void onLoginSuccess();
}
And your activity has:
public MyActivity implements LoginListener {
// instantiate the handler somewhere, with a reference
// to "this". "this" refers to the LoginListener interface
// which is implemented.
@Override
public void onCreate(Bundle b) {
mHandler = new MyHandler(this);
}
@Override
public void onLoginSuccess() {
Log.i(TAG, "Kewel beanZ");
}
}
Or, you can define LoginListener
as an interface inside the activity if you wish, and instantiate it as:
public LoginListener mListener = new LoginListener() {
@Override
public void onLoginSuccess() {
Log.i(TAG, "Sweet sweet baby beanz");
}
};
And instead of using this
, use mListener
, when you create MyHandler
.
0
solved Listener doesn’t work..It seems the Listener is 0