Skip to content

Instantly share code, notes, and snippets.

@sreelallalu
Created May 15, 2017 04:37
Show Gist options
  • Select an option

  • Save sreelallalu/c86ba4ac9322e6570da39c192ae3f8af to your computer and use it in GitHub Desktop.

Select an option

Save sreelallalu/c86ba4ac9322e6570da39c192ae3f8af to your computer and use it in GitHub Desktop.
Activity to Fragment <value sending> using interfce
//ACTIVITY
RefreshClick refreshClick;
public interface RefreshClick
{
void RefreshM();
}
///onclick event
refreshClick.RefreshM();
//initialize
public void setOnBundleSelected(RefreshClick selectedBundle) {
this.refreshClick = selectedBundle;
}
//FRAGMENT
((MainActivity)getActivity()).setOnBundleSelected(new MainActivity.RefreshClick() {
@Override
public void RefreshM() {
//do something....
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment