I was just going through the source code of Ion and found that Ion uses static HashMap static HashMap<String, Ion> instances = new HashMap<String, Ion>();
for storing Ion objects and calling Ion.with(context)
should return the same instance as evident from the code (correct me if I am wrong)
public static Ion getDefault(Context context) {
return getInstance(context, "ion");
}
public static Ion getInstance(Context context, String name) {
if (context == null)
throw new NullPointerException("Can not pass null context in to retrieve ion instance");
Ion instance = instances.get(name);
if (instance == null)
instances.put(name, instance = new Ion(context, name));
return instance;
}
but when I compare objects it returns false. Can anyone tell me what am I missing ?
Log.d(TAG, String.valueOf( Ion.with(getApplicationContext()).equals(Ion.with(getApplicationContext())) ));