onAttach Android Method

0

Well, I'm having trouble on how to use onattach. I have a view that is set visible when a button is triggered. I would like this View to disappear at the end of a fragment operation. Look at the Code that will make more sense.

In Activity:

    private View layoutProgress;

    protected void onCreate(Bundle savedInstanceState){

    layoutProgress = findViewById(R.id.layout_progress);

    layoutProgress.setVisibility(View.GONE);
    }

When the Button is flipped:

    fragment.getInstance().printScreen();(Função de Tirar foto no fragment)
    layoutProgress.setVisibility(View.VISIBLE);

No Fragment:

Performs the necessary and would like it to disappear the layoutProgress.

How to do this? Sorry for the edit, I'm still learning to format better.

    
asked by anonymous 08.09.2015 / 14:55

1 answer

0

I found a way, I'll post if anyone needs to

After the code runs in the fragment put this code:

    Activity act = getActivity();
    if (act == null) return;
    View layoutProgress = findViewById(R.id.layout_progress);
    
08.09.2015 / 16:39