architecture - Android Application Level Scope Variables -


i understand there no application level scope available able define shared logic/data, , each activity stand alone application tied manifest...

but have group of user access permissions getting via web service call , not want make call in every activities oncreate().

i using sharedpreferences in application, since permissions not intended editable user, flat file exposure on android devices feels insecure way handle this.

i need re-request info if application restarted, believe least expensive store in variable.

i aware of intentextras talking settings "object", not primitive type.

right way handle situation?

you can create "application" class can used create application wide settings.

just create new class , extend application, set class members , appropriate getter/setter methods , can access them throughout application.

you need update manifest follows:

<application android:icon="@drawable/logo"              android:label="@string/app_name"              android:name=".application.customapplication"> 

then in activity can access follows:

customapplication app = ((customapplication)getapplication()); 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -