Android Open Source - dv-quiz dv Quiz Context






From Project

Back to project page dv-quiz.

License

The source code is released under:

Apache License

If you think the Android project dv-quiz listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.dvorakdev.dvquiz.context;
//  www. ja va  2 s  . c om
import android.util.SparseArray;

public class dvQuizContext {

  private static dvQuizContext instance;
  
  private SparseArray<Object> values;
  
  public static dvQuizContext getInstance()
  {
    if (instance == null)
    {
      instance = new dvQuizContext();
      
      instance.setValues(new SparseArray<Object>());
    }
    
    return instance;
  }
  
  public void setValue(String aKey, Object aValue)
  {
    this.getValues().put(aKey.hashCode(), aValue);
  }
  
  public Object getValue(String aKey)
  {
    if (!this.hasValue(aKey))
    {
      return null;
    }
    
    return this.getValues().get(aKey.hashCode());
  }
  
  public Object getValue(String aKey, Object aDefaultValue)
  {
    return this.getValues().get(aKey.hashCode(), aDefaultValue);
  }
  
  public boolean hasValue(String aKey)
  {
    return !(this.getValues().indexOfKey(aKey.hashCode()) < 0);
  }
  
  public SparseArray<Object> getValues() {
    return values;
  }

  public void setValues(SparseArray<Object> values) {
    this.values = values;
  }
}




Java Source Code List

com.dvorakdev.dvquiz.AboutActivity.java
com.dvorakdev.dvquiz.CategoryFormActivity.java
com.dvorakdev.dvquiz.MainActivity.java
com.dvorakdev.dvquiz.QuizActivity.java
com.dvorakdev.dvquiz.QuizFormActivity.java
com.dvorakdev.dvquiz.QuizResultActivity.java
com.dvorakdev.dvquiz.context.dvQuizContext.java
com.dvorakdev.dvquiz.model.Answer.java
com.dvorakdev.dvquiz.model.Category.java
com.dvorakdev.dvquiz.model.Question.java
com.dvorakdev.dvquiz.model.Quiz.java
com.dvorakdev.dvquiz.reference.dvQuizReference.java
com.dvorakdev.lib.dvExpandableListAdapter.java
com.dvorakdev.lib.dvFileDialog.java
com.dvorakdev.lib.dvObjectRadioButton.java
com.dvorakdev.lib.dvUtils.java