Skip to content

Instantly share code, notes, and snippets.

@orhanobut
Created September 22, 2015 20:51
Show Gist options
  • Save orhanobut/7bedeb75b210f9ff8fe4 to your computer and use it in GitHub Desktop.
Save orhanobut/7bedeb75b210f9ff8fe4 to your computer and use it in GitHub Desktop.
public class LoginFragment extends Fragment {
private LoginListener listener;
@Override public void onAttach(Activity activity) {
super.onAttach(activity);
loginListener = (LoginListener) activity;
}
void onLoginClicked() {
listener.onLogin();
}
void onRegisterClicked() {
listener.onRegister();
}
public interface LoginListener {
void onLogin();
void onRegister();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment