Skip to content

Instantly share code, notes, and snippets.

@stephanenicolas
Last active September 27, 2017 00:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stephanenicolas/668f8dd9ceaf8239fb5556d5320ff651 to your computer and use it in GitHub Desktop.
Save stephanenicolas/668f8dd9ceaf8239fb5556d5320ff651 to your computer and use it in GitHub Desktop.
Lambda Way: HeadlinesFragment
public class HeadlinesFragment extends ListFragment {
HeadlineListener mCallback;
public <T> void setHeadlineListener(HeadlineListener<T> listener) {
this.mCallBack = listener;
}
@Override
public void onListItemClick(ListView l, View v, int p, long i) {
// Send the event to the host activity
mCallback.onArticleSelected(getActivity(), p);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment