25
votes
9answers
1k views

Is my code a 'safe' singleton?

I was wondering if my code will produce a true singleton. I am creating an Android app, and all activities should access my API through one instance of the SyncApi ...
7
votes
4answers
417 views

Sound manager for Android

I created a singleton class for managing sound effects on Android. This class will only be instanced and loaded once at the beginning, and each activity will use the loaded songs. I don't know either ...
4
votes
2answers
36 views

Android global data

I have a huge list of song objects in my program and I need those objects in almost all activities. Well, at least a part of it up to everything. So I created a class which looks pretty much like ...
4
votes
0answers
22 views

Searching for songs on an Android application

In my application I need to search for some songs on my external storage card every now and then. On startup I read everything, however when it comes to new activities I thought I could just pass the ...
3
votes
1answer
263 views

A parent class, a singleton subclass, and a subclass uses a builder [closed]

There are three classes and an interface. The parent class is called MobileSignal. It contains info about mobile signal. E.g., CID, LAC, device ID, MCC, user ...
1
vote
1answer
678 views

Why is android.app.Application not singleton by default [closed]

In many Android applications which I have found online or written myself, there is an application class like this: ...