6
I have an item in my Action Bar to display progress (a Progressbar) if a request is occurring. When the request occurs, I must show Progressbar and hide the other items, when the request ends, I must hide Progressbar and show the other items.
Diculdade
The request, ie my Asynctask, is executed when starting my Activity (actually it is a Fragment), ie before the operating system calls the creation of the menu with onCreateOptionsMenu().
I need to retrieve and manipulate the items of a Action Bar outside the scope of the method onCreateOptionsMenu(), that is at the beginning and end of Asynctask.
Observing
Asynctask is declassified into a class by class. Activity delegates to a class that manipulates and manages the methods of this Asynctask.
How to handle an Actionbar outside the scope of onCreateOptionsMenu()?
You can explain better what you want to do with the menu after obtained. Thank you.
– Eduardo Binotto
Eduardo, I need to hide/show. I’ll go into the question.
– Geison Santos
At what point do you intend to do this, you cannot use the onCreateOptionsMenu event().
– Eduardo Binotto
After running an asynctask. The item I want to hide is a progressbar. Show it during the request and hide it and display other items when completed the request.
– Geison Santos
You can take the
Menuat the eventonCreateOptionsMenu()and pass by parameter to yourAsyncTask. What do you think of the idea ?– Eduardo Binotto
My asynctask runs on onStart(), so before onCreateOptionsMenu() happens.
– Geison Santos
You can’t change the method in which your
AsyncTaskis executed ?– Eduardo Binotto
Your Asynctask is declared in Activity where it is used (nested class) or is a separate class?
– ramaral
In a separate class, @ramaral. Activity delegates to another class that contains Asynctask.
– Geison Santos