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

  • SEARCH
  • Home
  • 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 8611265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:20:00+00:00 2026-06-12T04:20:00+00:00

I was making an application to act as remote keyboard where user will click

  • 0

I was making an application to act as remote keyboard where user will click on an edittext and type and corresponding alphabets will b typed in computer.

I have detected variaous alphabets and numbers with the help of TextWatcher and sent them to my server successfully.

Problem comes when user presses enter key. This also triggers TextWatcher . and since i am sending the latest entered changes , error shows up on server side.

As a solution what i did is , set one onkeylistener as well which will detect the enter key and perform action and CONSUME it , but unfortunately in that case also first textwatcher gets triggered and then onkeylistener.

Here is the code of my onkeylistener

 keyboard.setOnKeyListener(new OnKeyListener() {                 
  public boolean onKey(View v, int keyCode, KeyEvent event) {                   
    if(keyCode == KeyEvent.KEYCODE_ENTER&&event.getAction()==KeyEvent.ACTION_UP){  
                   out.println("enter");
                 return true;
              }
        return false;
            }
    });

Code of TextWatcher :

  private TextWatcher watcher = new TextWatcher() {
public void onTextChanged(CharSequence s, int start, int before, int count)    {
        if(count>0){
        out.println(":"+s.subSequence(start, start+count).toString());
        }
    }
            .
            .
            .

Problem is on pressing enter key it fires TextWatcher’s onTextChanged as well as onkeylistener. whereas i want only on key listener to fire.
I want to fire Textwatcher only in case of alphabets , numbers , some symbols etc.

Also if you can suggest different approach for detecting and sending characters ( soft ) will be great .

  • 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-12T04:20:03+00:00Added an answer on June 12, 2026 at 4:20 am

    Ok i think i solved it. in Textwatcher add this if statement:

    if(s.toString().substring(start).contains("\n"))
    

    in that way if last key entered was ‘enter’ then it would go into this is and then u can perform whatever u want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making an application which will act as a virtual printer saving the
I have been making application in which i click on image and new window
I'm making an application to act as a hub of some sorts, where the
I am making application where phone mode will changes from silent mode to ringer
I making an application with my own keyboard and I want to completely DISABLE
I am making application in ASP.Net 2.0 in VS 2010, i have created crystal
Hi i am making application in c#.I have byte array of containing hex values.I
I am making an application in java and I want to have a terminal
I am making an application in visual studio for windows phone C# I have
I have started learning titanium framework.I was making application into iphone.I have made application

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.