Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8214949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:37:34+00:00 2026-06-07T11:37:34+00:00

I’m developing an android application which contains an EditText . I control what is

  • 0

I’m developing an android application which contains an EditText.

I control what is written in the editText by calling

et.addTextChangedListener(new TextWatcher() {
    public void afterTextChanged(Editable s) {
        String message = et.getText().toString();
        if(s.toString().compareTo(before)!=0){
            et.setText(message);
            et.setSelection(et.getText().length());
        }
    }

    public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        before = et.getText().toString();
        System.out.println("After");
    }

    public void onTextChanged(CharSequence s, int start, int before, int count) {
        System.out.println("ON");
    }
});

In afterTextChanged function I use et.setText("some Text");
the problem is that,after the text is changed the keyboard also changed,for example if the symbol keyboard was opened and I used setText, it will automatically changed to qwerty.

How can I solve this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T11:37:36+00:00Added an answer on June 7, 2026 at 11:37 am

    I could not find direct solution for your problem,but you can do some things that clear your problem! Use a text view that is on your edit text(for example you can use RelativeLayout to set text view on edit text),and set your edit text font color white(or edit text’s background color)so user can not see it’s real text.I hope this snippet help you:
    main.xml(in res/layout):

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/activityRoot"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
         >
    
        <EditText
            android:id="@+id/editText1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" >
    
            <requestFocus />
        </EditText>
    
        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="MyTextView" />
    
    </RelativeLayout>     
    

    Activity that you observe text changes:

    public class TestproGuardActivity extends Activity {
    
        EditText et;
        TextView tv1;
    
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
    
            tv1 = (TextView)findViewById(R.id.textView1);
            et = (EditText)findViewById(R.id.editText1);
    
            et.addTextChangedListener(new TextWatcher() {
                private String before = "hasan";
                public void afterTextChanged(Editable s) {
                   String message = et.getText().toString();
                   if(s.toString().compareTo(before )!=0){
    //               et.setText(message);
                       tv1.setText(message);
    //               et.setSelection(et.getText().length());
                   }
                }
                public void beforeTextChanged(CharSequence s, int start, int count, int after){
    
                    before = et.getText().toString();
    
                    System.out.println("After");   
    
                }
                public void onTextChanged(CharSequence s, int start, int before, int count)
                {
                    System.out.println("ON");
                }
            });
        }
    
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have a text area in my form which accepts all possible characters from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.