Gopikrishna S Gopikrishna S - 4 months ago 14
Android Question

Can I call setHasOptionsMenu() from Fragment Constructor?

Calling

setHasOptionsMenu(true)
from constructor, which is obviously called even before
onCreate()
, works perfectly! Can I do that? What will be problems?

Answer

Yes, you can call setHasOptionsMenu(true) from the constructor.

Comments