android - Is custom views context always an Activity? -


i have custom view inflated xml , has custom xml attributes.

this view setup things in actionbar, if xml attribute has been set true. therefore need reference activities action bar.

my question is: can assume context passed in constructor of

class myview extends view {     public myview(context context, attributeset attrs, int defstyle){           activity = (activity) context;      } } 

i have tested different devices , different android versions, , seems t context activity.

does know sure?

no. if theme layout containing view end contextthemewrapper.


Comments