How to Get EditText maxLength setting in code

Only limited parameters have their getters, so I don't think you can read it .

So write length (Say 12) in values folder and use it in xml layout and arrayAdapter . Now its not hard-coded .

1)Create integer.xml in values *

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <item type="integer" name="max_length">12</item>
</resources>

2)In layout

<TextView  android:id="@+id/tv"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
    android:maxLength="@integer/max_length"
    />

3) in ArrayAdapter :

int maxLength = getResources().getInteger(R.integer.max_length);

This should work:

editText.setFilters(new InputFilter[] { new InputFilter.LengthFilter(12) });