久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

從 onTextChangeListener() 更改 EditText 文本

Change EditText text from onTextChangeListener()(從 onTextChangeListener() 更改 EditText 文本)
本文介紹了從 onTextChangeListener() 更改 EditText 文本的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

限時(shí)送ChatGPT賬號..

我正在開發(fā)一個(gè) Android 應(yīng)用程序.在我的應(yīng)用程序中,我必須使用基于文本的圖像.所以我為 EditText 編寫 OnChangeListener().以下是我的示例代碼.

I am working on an Android application.In my app I have to use images based on the text.So I write OnChangeListener() for EditText.The following is my sample code.

edt.addTextChangedListener(this);  
@Override
public void afterTextChanged(Editable s) {
    // TODO Auto-generated method stub
    CharSequence cs=convert(edt.getText.toString());
            edt.setText(cs);
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
        int after) {
    // TODO Auto-generated method stub


}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
    // TODO Auto-generated method stub


}

但我收到上述代碼的異常.我知道異常的原因是從 afterTextChanged() 方法調(diào)用 setText().但是我必須根據(jù)相同的 EditText 文本更改來更改 EditText 文本值.幫助我的朋友

But I am getting Exception for the above code.I know the reason for the exception is calling setText() from afterTextChanged() method. But I have to change the EditText text value based on the same EditText text change.Help me friends

推薦答案

只需在設(shè)置文本之前移除您的監(jiān)聽器,并在完成后重新注冊,如下所述:

Just simply remove your listener before you set the text, and register it again after you are done, like described here:

添加 onTextChanged 實(shí)現(xiàn)后清除 EditText 文本

這篇關(guān)于從 onTextChangeListener() 更改 EditText 文本的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Cut, copy, paste in android(在android中剪切、復(fù)制、粘貼)
android EditText blends into background(android EditText 融入背景)
Change Line Color of EditText - Android(更改 EditText 的線條顏色 - Android)
EditText showing numbers with 2 decimals at all times(EditText 始終顯示帶 2 位小數(shù)的數(shù)字)
Changing where cursor starts in an expanded EditText(更改光標(biāo)在展開的 EditText 中的開始位置)
EditText, adjustPan, ScrollView issue in android(android中的EditText,adjustPan,ScrollView問題)
主站蜘蛛池模板: 久久综合久| 一级a爱片久久毛片 | 伊人精品在线 | 黄在线| 久久一区精品 | 91日b| 日韩欧美黄色 | 日韩精品久久一区 | 欧美日韩一区二区三区四区 | 18成人在线观看 | 成人精品视频 | 成人国产网站 | caoporn视频| 中文字幕日韩欧美 | 亚洲综合国产 | 国产一区不卡在线观看 | 日韩精品一区二区三区中文在线 | 亚洲欧美综合精品久久成人 | 中文字幕在线二区 | 亚洲精品99 | 久久精品视频12 | 在线亚洲免费 | 免费观看一级特黄欧美大片 | 亚洲欧美激情四射 | 中文字幕一区二区三区四区 | 国产精品www | 91av在线免费播放 | 色综合视频 | 国产综合网站 | 国产一级网站 | 91福利在线导航 | 亚洲一区在线播放 | 欧美午夜视频 | 亚洲精品乱码久久久久久按摩观 | 日韩网站免费观看 | 亚洲人在线观看视频 | 真人女人一级毛片免费播放 | 亚洲福利视频一区二区 | 红桃视频一区二区三区免费 | 午夜噜噜噜 | 国产日产精品一区二区三区四区 |