Limit text length in edit text
<p>I want to limit the text length of edit text ui element via code:</p>

<pre><code>EditText et = (EditText) parent.findViewById(R.id.smsBody);;
int maxLength = 300;

InputFilter[] FilterArray = new InputFilter[1];
FilterArray[0] = new InputFilter.LengthFilter(maxLength);
et.setFilters(FilterArray);
</code></pre>

<p>But this gives me a null pointer exception in the last line. Any ideas whats wrong? This codes is in the <code>onPostExecute</code> method of my async task class. <code>Parent</code> is the main activity.</p>
