Alex Rivera | Logout

Android: Check if a fragment is visible

Asked 2013-07-01T12:13:24.793
27

I have a FragmentActivity, some fragments and a service that is running in background. It is possible to check from the service if a specific fragment is visible?

Edit
Report

1 Answer

5

Check the code below:

public class MyFragment extends Fragment
            @Override
            public void setMenuVisibility(final boolean visible) {
                super.setMenuVisibility(visible);
                if (visible) {
                    ...
                }
            }

It's from this thread. Or you can also check this one.

answered 2013-07-01T12:17:09.307

Your Answer