首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >InputConnectionWrapper警告

InputConnectionWrapper警告
EN

Stack Overflow用户
提问于 2012-09-07 20:52:19
回答 4查看 39.4K关注 0票数 12

当我的应用程序可见时,我每次关闭屏幕时都会收到一个InputConnectionWrapper警告。我不知道为什么,因为我不使用InputConnection

这是LogCat的输出。

代码语言:javascript
复制
09-07 14:21:31.716: W/IInputConnectionWrapper(24197): getExtractedText on inactive InputConnection
09-07 14:21:31.724: W/IInputConnectionWrapper(24197): getExtractedText on inactive InputConnection
09-07 14:21:31.724: W/IInputConnectionWrapper(24197): getTextBeforeCursor on inactive InputConnection
09-07 14:21:31.724: W/IInputConnectionWrapper(24197): getTextAfterCursor on inactive InputConnection
09-07 14:21:31.724: W/IInputConnectionWrapper(24197): getExtractedText on inactive InputConnection
09-07 14:21:31.724: W/IInputConnectionWrapper(24197): getTextBeforeCursor on inactive InputConnection
09-07 14:21:31.724: W/IInputConnectionWrapper(24197): getTextAfterCursor on inactive InputConnection
09-07 14:21:31.732: W/IInputConnectionWrapper(24197): beginBatchEdit on inactive InputConnection
09-07 14:21:31.732: W/IInputConnectionWrapper(24197): endBatchEdit on inactive InputConnection
09-07 14:21:31.732: W/IInputConnectionWrapper(24197): getExtractedText on inactive InputConnection
09-07 14:21:31.732: W/IInputConnectionWrapper(24197): getTextBeforeCursor on inactive InputConnection
09-07 14:21:31.732: W/IInputConnectionWrapper(24197): getTextAfterCursor on inactive InputConnection
09-07 14:21:31.732: W/IInputConnectionWrapper(24197): beginBatchEdit on inactive InputConnection
09-07 14:21:31.732: W/IInputConnectionWrapper(24197): endBatchEdit on inactive InputConnection
09-07 14:21:31.732: W/IInputConnectionWrapper(24197): getExtractedText on inactive InputConnection
09-07 14:21:32.013: W/IInputConnectionWrapper(24197): showStatusIcon on inactive InputConnection
09-07 14:21:32.013: W/IInputConnectionWrapper(24197): getExtractedText on inactive InputConnection
09-07 14:21:32.021: W/IInputConnectionWrapper(24197): getExtractedText on inactive InputConnection
09-07 14:21:32.021: W/IInputConnectionWrapper(24197): getTextBeforeCursor on inactive InputConnection
09-07 14:21:32.021: W/IInputConnectionWrapper(24197): getTextAfterCursor on inactive InputConnection
09-07 14:21:32.021: W/IInputConnectionWrapper(24197): getExtractedText on inactive InputConnection
09-07 14:21:32.021: W/IInputConnectionWrapper(24197): getTextBeforeCursor on inactive InputConnection
09-07 14:21:32.021: W/IInputConnectionWrapper(24197): getTextAfterCursor on inactive InputConnection
09-07 14:21:32.021: W/IInputConnectionWrapper(24197): beginBatchEdit on inactive InputConnection
09-07 14:21:32.021: W/IInputConnectionWrapper(24197): endBatchEdit on inactive InputConnection
09-07 14:21:32.021: W/IInputConnectionWrapper(24197): getExtractedText on inactive InputConnection
09-07 14:21:32.021: W/IInputConnectionWrapper(24197): getTextBeforeCursor on inactive InputConnection
09-07 14:21:32.021: W/IInputConnectionWrapper(24197): getTextAfterCursor on inactive InputConnection
09-07 14:21:32.028: W/IInputConnectionWrapper(24197): beginBatchEdit on inactive InputConnection
09-07 14:21:32.028: W/IInputConnectionWrapper(24197): endBatchEdit on inactive InputConnection
09-07 14:21:32.028: W/IInputConnectionWrapper(24197): getExtractedText on inactive InputConnection
EN

回答 4

Stack Overflow用户

发布于 2016-11-09 04:13:09

在我的例子中,在按钮布局中,我有这个:android:textIsSelectable="true",只要移除它,问题就解决了……

票数 0
EN

Stack Overflow用户

发布于 2020-10-19 18:24:32

我正在使用webView浏览需要注册或登录的网址。当我将焦点切换到不同的TextField时,我的应用程序就死机了,我得到了上面同样的错误。

我设法解决这个问题的方法是,它缺少下面这段关键代码:

代码语言:javascript
复制
@override
void initState() {
  super.initState();
  if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView();
}

这段代码应该位于扩展主类的实例类的声明之后,并且在build Widget函数之前。

在错误日志中,您可能仍然会看到相同的警告,但它肯定会解决导致的任何问题,无论是Swift键盘还是TextFields本身。

票数 0
EN

Stack Overflow用户

发布于 2019-07-11 16:46:37

代码语言:javascript
复制
TextWatcher textWatcherContent = new TextWatcher() {

    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {

    }

    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {

    }

    @Override
    public void afterTextChanged(Editable s) {
        String content = mTxtContent.getText().toString();
        String contact = mTxtContact.getText().toString();
        if (null != mTxtContent && null != mTxtLength) {
            int length = mTxtContent.getText().toString().length();

            if (length > 200) {

                mTxtContent.removeTextChangedListener(textWatcherContent);
                SpannableString spannableString = new SpannableString(content);

                spannableString.setSpan(new ForegroundColorSpan(Color.parseColor("#FF3838")), 200
                            , mTxtContent.length() , Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
                mTxtContent.getText().clear();
                mTxtContent.append(spannableString);
                mTxtContent.setSelection(content.length());

                mTxtContent.addTextChangedListener(textWatcherContent);
            }          
        }
    }
};
票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12318521

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档