Skip to content

Instantly share code, notes, and snippets.

@EfeBudak
Created July 11, 2017 06:07
Show Gist options
  • Save EfeBudak/cf7122858b6f334550b1be1912e021da to your computer and use it in GitHub Desktop.
Save EfeBudak/cf7122858b6f334550b1be1912e021da to your computer and use it in GitHub Desktop.
Application context on Toast message sample
public class LoginFragment extends Fragment{
@Inject
Context mContext;
@Override
public void onAttach(Context context) {
AndroidSupportInjection.inject(this);
super.onAttach(context);
}
@Override
public void showWelcomeMessage(String message) {
Toast.makeText(mContext, message, Toast.LENGTH_LONG).show();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment