I'm pretty new to programming for Android so if this is the wrong way to go about it anyway, feel free to comment about my bad practice.
In my App, I have different Activities that use the same values. Also, I have some classes that have static methods, used in multiple activities. For example to generate ImageViews from a "URL".
One of the values I would use in almost all of my app is this snippet: (taken from another question on SO)
getApplicationContext().getResources().getDisplayMetrics().density
This particular value for example is needed for every activity. But it's also needed for the same task. So I use a static class that has the appropriate method for that task. However, that static class does not have a "getApplicatioContext", obviously. So I would need to store the value somewhere else.
My question is, is there a designated or at least optimal or clean way to store such values and initialize them on App startup?
As I understand it, I could use the "onCreate"-Method of my launch activity and initialize some static class or something like that. However, that seems a little dirty to me. Maybe there is some "earlier" time than the launch activity's onCreate() and a better place to store the values than a custom static (or singleton) class?