title: Android app java.lang.RuntimeException error
body: <p>Hi I'm trying to build a calculator to calculate compound interest, I'm keep getting a <code>java.lang.RuntimeException</code> error. I've read some topics on stackoverflow and their problems seems something wrong with their AndroidManifest.xml. I didn't edit that file at all but I'm still getting this error.
  Here's the code:</p>
  
  <pre><code> package com.hychentsa.compoundinterest_v001;
  
      import android.os.Bundle;
      import android.app.Activity;
      import android.view.Menu;
      import android.view.View;
      import android.widget.Button;
      import android.widget.EditText;
      import java.lang.Math;
  
  
      public class MainActivity extends Activity {
          private Button btn1;
          private EditText edt1, edt2, edt3, edt4 ,edt5, edt6;
          @Override
          protected void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.activity_main);
  
          btn1 = (Button)findViewById(R.id.btn1);
  
          edt1 = (EditText)findViewById(R.id.edt1);
          edt2 = (EditText)findViewById(R.id.edt2);
          edt3 = (EditText)findViewById(R.id.edt3);
          edt4 = (EditText)findViewById(R.id.edt4);
          edt5 = (EditText)findViewById(R.id.edt5);
          edt6 = (EditText)findViewById(R.id.edt6);
  
          btn1.setOnClickListener(btn1listener);
      }
      double capital = Double.parseDouble(edt1.getText().toString());
      double everyyear = Double.parseDouble(edt2.getText().toString());
      double interest = Double.parseDouble(edt3.getText().toString());
      double year = Double.parseDouble(edt4.getText().toString());
  
      private Button.OnClickListener btn1listener = new Button.OnClickListener()
      {
          public void onClick (View v)
          {
              double capital = Double.parseDouble(edt1.getText().toString());
              double everyyear = Double.parseDouble(edt2.getText().toString());
              double interest = Double.parseDouble(edt3.getText().toString());
              double year = Double.parseDouble(edt4.getText().toString());
              double interestperyear = capital * Math.pow(1 + interest, year) + 
                      everyyear * (1 - Math.pow(1 + interest, year)) / interest * -1;
              edt5.setText(String.valueOf(interestperyear));
              edt6.setText(String.valueOf(interestperyear / 12));
          }
      };
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.main, menu);
          return true;
      }
  
  }
  </code></pre>
  
  <p>And here's the logcat:</p>
  
  <pre><code>07-15 13:45:23.640: D/AndroidRuntime(1763): Shutting down VM
  07-15 13:45:23.650: W/dalvikvm(1763): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
  07-15 13:45:23.660: E/AndroidRuntime(1763): FATAL EXCEPTION: main
  07-15 13:45:23.660: E/AndroidRuntime(1763): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.hychentsa.compoundinterest_v001/com.hychentsa.compoundinterest_v001.MainActivity}: java.lang.NullPointerException
  07-15 13:45:23.660: E/AndroidRuntime(1763):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
  07-15 13:45:23.660: E/AndroidRuntime(1763):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
  07-15 13:45:23.660: E/AndroidRuntime(1763):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
  07-15 13:45:23.660: E/AndroidRuntime(1763):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
  07-15 13:45:23.660: E/AndroidRuntime(1763):     at android.os.Handler.dispatchMessage(Handler.java:99)
  07-15 13:45:23.660: E/AndroidRuntime(1763):     at android.os.Looper.loop(Looper.java:137)
  07-15 13:45:23.660: E/AndroidRuntime(1763):     at android.app.ActivityThread.main(ActivityThread.java:5041)
  07-15 13:45:23.660: E/AndroidRuntime(1763):     at java.lang.reflect.Method.invokeNative(Native Method)
  07-15 13:45:23.660: E/AndroidRuntime(1763):     at java.lang.reflect.Method.invoke(Method.java:511)
  07-15 13:45:23.660: E/AndroidRuntime(1763):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
  07-15 13:45:23.660: E/AndroidRuntime(1763):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
  07-15 13:45:23.660: E/AndroidRuntime(1763):     at dalvik.system.NativeStart.main(Native Method)
  07-15 13:45:23.660: E/AndroidRuntime(1763): Caused by: java.lang.NullPointerException
  07-15 13:45:23.660: E/AndroidRuntime(1763):     at com.hychentsa.compoundinterest_v001.MainActivity.&lt;init&gt;(MainActivity.java:30)
  07-15 13:45:23.660: E/AndroidRuntime(1763):     at java.lang.Class.newInstanceImpl(Native Method)
  07-15 13:45:23.660: E/AndroidRuntime(1763):     at java.lang.Class.newInstance(Class.java:1319)
  07-15 13:45:23.660: E/AndroidRuntime(1763):     at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
  07-15 13:45:23.660: E/AndroidRuntime(1763):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
  07-15 13:45:23.660: E/AndroidRuntime(1763):     ... 11 more
  </code></pre>