Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

There is normally no need to subclass application?

Tags:

android

Per the Android Documentation it states (http://developer.android.com/reference/android/app/Application.html) :

There is normally no need to subclass Application. 

My question is that. My app needs to prepare some data (e.g. load some states data from shared preference) at app startup time before it can do anything else. I usually put the data preparation logic in a class that subclasses Application.

If subclassing application is not encouraged, where should I put the app-startup-time data preparation logic? What are the best practices?

Thanks.

like image 681
Kai Avatar asked Mar 19 '23 15:03

Kai


1 Answers

Its not that it is discouraged, its just that as they said, it is "normally" not needed.

In your case, you use it correctly, I have done the same in many of my own apps.

like image 145
r2DoesInc Avatar answered Apr 29 '23 02:04

r2DoesInc