I was wondering, I am using Application subclass to access some global data inside Activities. And I was wondering what would be better in terms off performance and memory.
Is it better to assign application object to field variable in onCreate and access it as a mamber
Activity
onCreate() {
mApp = (MyApplication) getApplication()
}
or
Dont use a member and call getApplication every single time and assign it just to a local variable?
MyApplication app = (MyApplication) getApplication()
From my knowledge, local variables are allowed to be garbage collected right away but members have to be kept in memory.
Since I presume Application object is a big object, is it okay to keep it in memory or should I allow it to get garbage collected?
Thanks