jpardogo / GoogleProgressBar

Android library to display progress like google does in some of his services.
Apache License 2.0
1.3k stars 271 forks source link

null instead context in fragments #24

Open abbashosseini opened 8 years ago

abbashosseini commented 8 years ago

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();
    }