title: How do I save a color?
body: <p>I'm using Lars Werkman's HoloColorPicker in my app, and would like to save the color and reuse it in other activities. </p>
  
  <p>Should a color value be saved as string, int or something else?
  I have tried string and int, but with no sucess.</p>
  
  <p>I don't know much about programming, so try to explain as thoroughly as possible :)</p>
  
  <p><a href="https://github.com/LarsWerkman/HoloColorPicker" rel="nofollow">HoloColorPicker - GitHub</a></p>
  
  <p>picker.getColor(); returns an ARGB value, how can I save that value and use it somewhere else?</p>
  
  <pre><code>@Override
  public void onColorChanged(int color) {
      //gives the color when it's changed.
  
      colorValue = Integer.valueOf(picker.getColor());
  
      editor.clear();
      editor.putInt("themes_colorcode", colorValue);
      editor.commit();
  }
  </code></pre>
  
  <p>The code below should work in onCreate, right?</p>
  
  <pre><code>    actionBar.setBackgroundDrawable(new ColorDrawable(colorValue));
  </code></pre>
  
  <p>But I get this error:</p>
  
  <pre><code>Process: com.okramuf.musikteori, PID: 28274
  java.lang.RuntimeException: Unable to start activity ComponentInfo{com.okramuf.musikteori/com.okramuf.musikteori.settings}: java.lang.NullPointerException
          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
          at android.app.ActivityThread.access$800(ActivityThread.java:135)
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
          at android.os.Handler.dispatchMessage(Handler.java:102)
          at android.os.Looper.loop(Looper.java:136)
          at android.app.ActivityThread.main(ActivityThread.java:5017)
          at java.lang.reflect.Method.invokeNative(Native Method)
          at java.lang.reflect.Method.invoke(Method.java:515)
          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
          at dalvik.system.NativeStart.main(Native Method)
   Caused by: java.lang.NullPointerException
          at com.okramuf.musikteori.settings.onCreate(settings.java:51)
          at android.app.Activity.performCreate(Activity.java:5231)
          at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
              at android.app.ActivityThread.access$800(ActivityThread.java:135)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
              at android.os.Handler.dispatchMessage(Handler.java:102)
              at android.os.Looper.loop(Looper.java:136)
              at android.app.ActivityThread.main(ActivityThread.java:5017)
              at java.lang.reflect.Method.invokeNative(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:515)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
              at dalvik.system.NativeStart.main(Native Method)
  </code></pre>