null pointer when setText of a EditText
<p>Thsi is my code:  </p>

<pre><code>EditText editCategoryName, editBrandName;
    private ArrayAdapter&lt;String&gt; myAdapter1, myAdapter2;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//      mylist = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
//      mylist2 = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
        myList1 = new ArrayList&lt;String&gt;();
        myList2 = new ArrayList&lt;String&gt;();
        editCategoryName = (EditText)findViewById(R.id.editCategoryName);
        editBrandName = (EditText)findViewById(R.id.editBrandName);
        editCategoryName.setText("Google is your friend.", TextView.BufferType.EDITABLE);

&lt;EditText
        android:id="@+id/editCategoryName"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="請輸入分類名稱"
        android:singleLine="true" &gt;
    &lt;/EditText&gt;

    &lt;TextView
        android:id="@+id/textSpinnerBrand"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:hint="hint" /&gt;

    &lt;Spinner
        android:id="@+id/spinnerBrand"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" /&gt;

    &lt;EditText
        android:id="@+id/editBrandName"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="hint"
        android:singleLine="true" &gt;
    &lt;/EditText&gt;
</code></pre>

<p>The null pointer error shows that in line:</p>

<pre><code>editCategoryName.setText("Google is your friend.", TextView.BufferType.EDITABLE);
</code></pre>

<p>I don't know why. Please help..</p>
