public void setText (CharSequence text, boolean filter)
Like setText(CharSequence)
, except that it can disable filtering.
Parameters
filter | If false , no filtering will be performed as a result of this call. |
---|
//官方文档标注为API.17才添加:public void setText(CharSequence text, boolean filter)
//Android Lint 是会检测到错误的!
//但是经过实际的机器测试中兴U880的2.2系统API8居然运行一切正常!很奇葩!
//为了以防万一,还是做一下异常处理
try
{
this.mCuurentView.setText(“something”, false);
}
catch (final Exception ex)
{
LogEx.e("setText(CharSequence text, boolean filter)果然报错了!", ex);
}
android - why high API level added method AutoCompleteTextView.setText(CharSequence, boolean) run on low API level device work well - Stack Overflow
http://stackoverflow.com/questions/29894904/why-high-api-level-added-method-autocompletetextview-settextcharsequence-boole/29958789#29958789
Thanks CommonsWare!
Android 2.2.3 Source Code Cross Reference: AutoCompleteTextView.java#setText
/**
967 * Like {@link #setText(CharSequence)}, except that it can disable filtering.
968 *
969 * @param filter If <code>false</code>, no filtering will be performed
970 * as a result of this call.
971 *
972 * @hide Pending API council approval.
973 */
974 public void setText(CharSequence text, boolean filter) {
975 if (filter) {
976 setText(text);
977 } else {
978 mBlockCompletion = true;
979 setText(text);
980 mBlockCompletion = false;
981 }
982 }
@hide
and therefore was excluded from the Android SDK. Not every device before API Level 17 will necessarily have that method, as device manufacturers can change anything that is not part of the Android SDK. – CommonsWare2 days ago