jimbob
jimbob

Reputation: 3298

Accessing the Activity using a Fragment

I am trying to access the activity using my fragment.

This is how I am accessing it:

    RelativeLayout titleBar = (RelativeLayout) getActivity().findViewById(R.id.pullupTitleBar);
    titleBar.setVisibility(View.INVISIBLE);

the activities view does not change invisible though. Also tried View.GONE. What am I doing wrong?

Upvotes: 0

Views: 29

Answers (2)

jimbob
jimbob

Reputation: 3298

the answer was to actually do it the other way round and access the fragment from the activity instead!

Upvotes: 0

alrama
alrama

Reputation: 648

You have to use:

  getActivity().getWindow().getDecorView().findViewById(R.id.pullupTitleBar);

Upvotes: 1

Related Questions