All Questions
10 questions
2
votes
0
answers
152
views
SharedPreferences singleton wrapper
I was wondering wether my implementation of the PreferenceService below is thread safe or could cause memory leaks.
Android Studio gives me the warning "Do not place Android context classes in ...
3
votes
1
answer
2k
views
Implementation of an OkHttp singleton for Android
I'm new to Android programming. I am going to make lots of HTTP requests: 500, 1k, 2k, 10k.
I have tried to create a singleton class for OkHttp. I wrote this:
...
3
votes
1
answer
4k
views
Static class for constants with reference to java resources
I want to store the colors I use in the colors.xml file. In addition to using them in an xml-layout, I also want to use these colors in my Java code, when drawing ...
4
votes
1
answer
258
views
JSON loader with event bus, cache, and session
I have an Android application which needs to retrieve JSON files from a server and then display the information in my app. To accomplish this I have the following architecture:
The main activity adds ...
6
votes
1
answer
153
views
Android app with config and customization classes
I have an Android app with three different Activity classes. Each of the Activities uses and changes config and user-customization data stored in a wrapped ...
2
votes
2
answers
3k
views
Proper way to wait end of a service and singleton design
My code works fine and I would like to know if I chose the best strategy to implement my code, or if It can written better (more fast, more clear, best use of design pattern, etc).
In my android ...
6
votes
1
answer
3k
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 ...
5
votes
2
answers
2k
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 ...
12
votes
4
answers
5k
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 ...
41
votes
7
answers
3k
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 ...