title: Why does this code generate an exception?
body: <p>I'm a beginner in Android developing and i'm trying to make a camera application.
  I put all of the code in pastebin; here are links:</p>
  
  <p>Main.java: <a href="http://pastebin.com/Eb9Vg96Q" rel="nofollow">here</a></p>
  
  <p>CameraControl.java: <a href="http://pastebin.com/6WQ75wbH" rel="nofollow">here</a></p>
  
  <p>CameraPreview.java: <a href="http://pastebin.com/vrdUGfV5" rel="nofollow">here</a></p>
  
  <p>The code is a little messy, but i hope you can read it.</p>
  
  <p>Here is the exception message from logcat:</p>
  
  <pre><code>08-30 17:31:48.299: E/AndroidRuntime(2558): FATAL EXCEPTION: main
  08-30 17:31:48.299: E/AndroidRuntime(2558): java.lang.NullPointerException
  08-30 17:31:48.299: E/AndroidRuntime(2558):     at com.maccer.vidcamtest.Main$1.onClick(Main.java:25)
  08-30 17:31:48.299: E/AndroidRuntime(2558):     at android.view.View.performClick(View.java:2485)
  08-30 17:31:48.299: E/AndroidRuntime(2558):     at android.view.View$PerformClick.run(View.java:9080)
  08-30 17:31:48.299: E/AndroidRuntime(2558):     at android.os.Handler.handleCallback(Handler.java:587)
  08-30 17:31:48.299: E/AndroidRuntime(2558):     at android.os.Handler.dispatchMessage(Handler.java:92)
  08-30 17:31:48.299: E/AndroidRuntime(2558):     at android.os.Looper.loop(Looper.java:130)
  08-30 17:31:48.299: E/AndroidRuntime(2558):     at android.app.ActivityThread.main(ActivityThread.java:3687)
  08-30 17:31:48.299: E/AndroidRuntime(2558):     at java.lang.reflect.Method.invokeNative(Native Method)
  08-30 17:31:48.299: E/AndroidRuntime(2558):     at java.lang.reflect.Method.invoke(Method.java:507)
  08-30 17:31:48.299: E/AndroidRuntime(2558):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
  08-30 17:31:48.299: E/AndroidRuntime(2558):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636)
  08-30 17:31:48.299: E/AndroidRuntime(2558):     at dalvik.system.NativeStart.main(Native Method)
  </code></pre>