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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -