博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Android的AutoCompleteTextView在API17高版本添加的setText函数在低版本系统居然能正常调用?官方文档是不是不靠谱了?...
阅读量:6696 次
发布时间:2019-06-25

本文共 1599 字,大约阅读时间需要 5 分钟。

官方文档:

 

public void setText ( text, boolean filter)

Added in 

Like , 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

 

Another possibility is that the method had been in Android for some time, but was marked with @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. –  2 days ago

Thanks !

Android 2.2.3 Source Code Cross Reference: 

/**967     * Like {@link #setText(CharSequence)}, except that it can disable filtering.968     *969     * @param filter If false, no filtering will be performed970     *        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    }

 

转载于:https://www.cnblogs.com/AsionTang/p/4461079.html

你可能感兴趣的文章
Why std::binary_search of std::list works, sorta ...(转载)
查看>>
一起谈.NET技术,在MVC2.0使用Lodop为WEB打印提出完美解决方案
查看>>
瑞星2009:3大拦截2大防御功能主动遏制木马病毒
查看>>
Android RIL源码研究笔记 の ril (一)
查看>>
手动添加mysql服务
查看>>
javascirpt历史澄清误解基本概念特点编程语言web2.0网页javascript - javascirpt知识大全...
查看>>
Java多线程同步Synchronized使用分析
查看>>
[ mongoDB ] - mongoDB的基本操作
查看>>
Linux文件、目录权限及常用命令
查看>>
windows下apache+php+mysql 环境配置方法
查看>>
gson-2.2.api简单
查看>>
泛型复习
查看>>
mysql-5.7中的innodb_buffer_pool_prefetching(read-ahead)详解
查看>>
转载CSDN博文精选:Android系列开发博客资源汇总
查看>>
DiscoveryService.getRemoteAdvertisements是否会获得本地通告?
查看>>
小球游戏1
查看>>
asp.net中的记忆盲区
查看>>
windows 7鼠标右键另存为没有桌面选项
查看>>
【转载】 Asp.net Mvc 3当然也不会例
查看>>
识别移动设备脚本
查看>>