What is a singleton class in Android? code example
Example: What is a singleton class in Android?
private static volatile RESTService instance;
protected RESTService(Context context) {
super(context);
}
public static RESTService getInstance(Context context) {
if (instance == null) {
synchronized (RESTService.class) {
if (instance == null) instance = new RESTService(context);
}
}
return instance;
}