Code example for Application

Methods: getDefaultSharedPreferences

0
	private final Object lock;
 
	public AndroidCalculatorEngine(@Nonnull Application application) {
		this.context = application;
 
		PreferenceManager.getDefaultSharedPreferences(application).registerOnSharedPreferenceChangeListener(this);
 
		this.lock = new Object();
 
		final JsclMathEngine engine = JsclMathEngine.getInstance();
		this.calculatorEngine = new CalculatorEngineImpl(engine,
				new CalculatorVarsRegistry(engine.getConstantsRegistry(), new AndroidMathEntityDao<Var>("org.solovyev.android.calculator.CalculatorModel_vars", application, Vars.class)),
				new CalculatorFunctionsMathRegistry(engine.getFunctionsRegistry(), new AndroidMathEntityDao<AFunction>("org.solovyev.android.calculator.CalculatorModel_functions", application, Functions.class)),
				new CalculatorOperatorsMathRegistry(engine.getOperatorsRegistry(), new AndroidMathEntityDao<MathPersistenceEntity>(null, application, null)),
				new CalculatorPostfixFunctionsRegistry(engine.getPostfixFunctionsRegistry(), new AndroidMathEntityDao<MathPersistenceEntity>(null, application, null)),
				this.lock);
	} 
 
	@Override 
	@Nonnull 
	public CalculatorMathRegistry<IConstant> getVarsRegistry() {