Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

null instead context in fragments #24

Open
abbashosseini opened this issue Mar 15, 2016 · 0 comments
Open

null instead context in fragments #24

abbashosseini opened this issue Mar 15, 2016 · 0 comments

Comments

@abbashosseini
Copy link

some time in fragment throws exception when i use :

//So i use it like this 
getActivity().findViewById(R.id.google_progress).setVisibility(View.INVISIBLE);

and i know getActivity some time return null instead context but still is problem ! you have any suggest can cover this ?

/**
     * Return the {@link FragmentActivity} this fragment is currently associated with.
     * May return {@code null} if the fragment is associated with a {@link Context}
     * instead.
     */
    final public FragmentActivity getActivity() {
        return mHost == null ? null : (FragmentActivity) mHost.getActivity();
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant