I have been trying to use the `addTextChangedListener` for three days, The log says that it is caused by **java.lang.NullPointerException**. When I comment the `addTextChangedListener` block the program runs fine.

```
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.os.Build;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class calc extends ActionBarActivity {
    EditText text;
    private TextView textout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_calc);
        text = (EditText) findViewById(R.id.fs);
        if (savedInstanceState == null) {
            getSupportFragmentManager().beginTransaction()
                    .add(R.id.container, new PlaceholderFragment())
                    .commit();
        }
        text.addTextChangedListener(new TextWatcher() {

            @Override
            public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {            }

            @Override
            public void afterTextChanged(Editable s) {
            }
        });
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {

        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.calc, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }

    /**
     * A placeholder fragment containing a simple view.
     */
    public static class PlaceholderFragment extends Fragment {

        public PlaceholderFragment() {
        }

        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                Bundle savedInstanceState) {
            View rootView = inflater.inflate(R.layout.fragment_calc, container, false);
            return rootView;
        }
    }

}

```

And here we have the log.

```
 01-09 16:03:12.280    1088-1088/com.fuzato.buckconverter E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.fuzato.buckconverter, PID: 1088
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.fuzato.buckconverter/com.fuzato.buckconverter.calc}: 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.fuzato.buckconverter.calc.onCreate(calc.java:39)
            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)

```

The log says that the problem is found in `onCreate` and it is caused by a **java.lang.NullPointerException**.

Any thoughts?

Thanks for everything!

Layout:

```
<RelativeLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:clickable="false">

    <GridLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignWithParentIfMissing="false"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_marginLeft="61dp"
        android:layout_marginTop="43dp"
        android:id="@+id/gridLayout">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Switching Freq. (Fs)"
            android:id="@+id/fs"
            android:layout_row="0"
            android:layout_column="0" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Output Voltage (V2)"
            android:id="@+id/V2"
            android:layout_row="1"
            android:layout_column="0" />

        <EditText
            android:layout_width="124dp"
            android:layout_height="wrap_content"
            android:inputType="number"
            android:ems="10"
            android:id="@+id/V2"
            android:layout_row="1"
            android:layout_column="1"
            android:text="10" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Volts"
            android:id="@+id/textView12"
            android:layout_row="1"
            android:layout_column="2" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Input Voltage (V1)"
            android:id="@+id/textView3"
            android:layout_row="2"
            android:layout_column="0" />

        <EditText
            android:layout_width="124dp"
            android:layout_height="wrap_content"
            android:inputType="number"
            android:ems="10"
            android:id="@+id/V1"
            android:layout_row="2"
            android:layout_column="1"
            android:text="10" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Volts"
            android:id="@+id/textView13"
            android:layout_row="2"
            android:layout_column="2" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Duty Cycle (k)"
            android:id="@+id/k"
            android:layout_row="3"
            android:layout_column="0" />

        <EditText
            android:layout_width="124dp"
            android:layout_height="wrap_content"
            android:inputType="number"
            android:ems="10"
            android:id="@+id/k"
            android:layout_row="3"
            android:layout_column="1" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Current Ripple (ΔI)"
            android:id="@+id/textView5"
            android:layout_row="4"
            android:layout_column="0" />

        <EditText
            android:layout_width="124dp"
            android:layout_height="wrap_content"
            android:inputType="number"
            android:ems="10"
            android:id="@+id/deltaI"
            android:layout_row="4"
            android:layout_column="1" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Amps"
            android:id="@+id/textView15"
            android:layout_row="4"
            android:layout_column="2" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Voltage Ripple (ΔV)"
            android:id="@+id/textView6"
            android:layout_row="5"
            android:layout_column="0" />

        <EditText
            android:layout_width="124dp"
            android:layout_height="wrap_content"
            android:inputType="number"
            android:ems="10"
            android:id="@+id/deltaV"
            android:layout_row="5"
            android:layout_column="1" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Volts"
            android:id="@+id/textView16"
            android:layout_row="5"
            android:layout_column="2" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Max current (Imax)"
            android:id="@+id/Imax"
            android:layout_row="6"
            android:layout_column="0" />

        <EditText
            android:layout_width="124dp"
            android:layout_height="wrap_content"
            android:inputType="number"
            android:ems="10"
            android:id="@+id/Imax"
            android:layout_row="6"
            android:layout_column="1" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Amps"
            android:id="@+id/textView17"
            android:layout_row="6"
            android:layout_column="2" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Min Current (Imin)"
            android:id="@+id/Imin"
            android:layout_row="7"
            android:layout_column="0" />

        <EditText
            android:layout_width="124dp"
            android:layout_height="wrap_content"
            android:inputType="number"
            android:ems="10"
            android:id="@+id/Imin"
            android:layout_row="7"
            android:layout_column="1" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Amps"
            android:id="@+id/textView18"
            android:layout_row="7"
            android:layout_column="2" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Inductance (L)"
            android:id="@+id/Ind"
            android:layout_row="8"
            android:layout_column="0" />

        <EditText
            android:layout_width="124dp"
            android:layout_height="wrap_content"
            android:inputType="number"
            android:ems="10"
            android:id="@+id/L"
            android:layout_row="8"
            android:layout_column="1" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="mH"
            android:id="@+id/textView19"
            android:layout_row="8"
            android:layout_column="2" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Capacitance (C)"
            android:id="@+id/cap"
            android:layout_row="9"
            android:layout_column="0" />

        <EditText
            android:layout_width="124dp"
            android:layout_height="wrap_content"
            android:inputType="number"
            android:ems="10"
            android:id="@+id/fs"
            android:layout_row="0"
            android:layout_column="1"
            android:text="10" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Hz"
            android:id="@+id/textView11"
            android:layout_row="0"
            android:layout_column="2" />

        <EditText
            android:layout_width="124dp"
            android:layout_height="wrap_content"
            android:inputType="number"
            android:ems="10"
            android:id="@+id/C"
            android:layout_row="9"
            android:layout_column="1" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="uF"
            android:id="@+id/textView20"
            android:layout_row="9"
            android:layout_column="2" />
    </GridLayout>

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignRight="@+id/gridLayout"
        android:id="@+id/relativeLayout">

    </RelativeLayout>

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="apply"
        android:id="@+id/button"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true" />

    <EditText
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/enter"
        android:layout_below="@+id/relativeLayout"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"
        android:layout_marginRight="94dp"
        android:text="3" />

</RelativeLayout>

```

I have also tried to debbug it in my phone, I get the same problem.