1. Download our Official Android App: Forums for Android!

Apps Code to hide the Chinese suggestions when the user enters text on the editText?

Discussion in 'Android Development' started by hyungjungsoh, Dec 31, 2010.

  1. hyungjungsoh

    hyungjungsoh Newbie
    Thread Starter
    Rank:
    None
    Points:
    16
    Posts:
    18
    Joined:
    Nov 7, 2010

    Nov 7, 2010
    18
    1
    16
    남한
    Is there such a code to hide the Chinese suggestions when the user enters text on the editText? I was able to find the code for hiding the virtual keyboard using:

    Code (Text):
    1. InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
    2.                 imm.hideSoftInputFromWindow(name.getWindowToken(),0);    
    I was expecting that it will also hide the chinese characters that pop out when the user enters the text... but it didn't. It only hid the keyboard. T_T Anybody have any idea on this...?

    ~Cheers
    ~Happy new year everyone.
    ~Hyun Jung Soh
     

    Advertisement

  2. id0001

    id0001 Well-Known Member
    Rank:
    None
    Points:
    38
    Posts:
    142
    Joined:
    Apr 20, 2010

    Apr 20, 2010
    142
    23
    38
    Student.. also software developer
    Netherlands
    You will have to set the 'textNoSuggestions' flag in the InputType property of your EditText.

    InputType
     
    hyungjungsoh likes this.
  3. hyungjungsoh

    hyungjungsoh Newbie
    Thread Starter
    Rank:
    None
    Points:
    16
    Posts:
    18
    Joined:
    Nov 7, 2010

    Nov 7, 2010
    18
    1
    16
    남한
    Arigato! :3 I'll definitely try it.
     
  4. hyungjungsoh

    hyungjungsoh Newbie
    Thread Starter
    Rank:
    None
    Points:
    16
    Posts:
    18
    Joined:
    Nov 7, 2010

    Nov 7, 2010
    18
    1
    16
    남한
    I have just tried this today but it does not seem to work... I am using Android 2.1 API level 7 and that is supposed to be supported by level 5 and above...

    However, I was able to find a remedy by using:

    Code (Text):
    1. android:inputType="textVisiblePassword"
    I also made sure that the setInputType(0) was inside an onClickListener.. not on the onCreate() so that it will not over write the inputType that I have set for the app.

    Code (Text):
    1.  
    2. [COLOR=YellowGreen]//when the user clicks on the editText, the virtual keyboard won't appear. :)[/COLOR]
    3. name.setOnClickListener(new View.OnClickListener() {
    4.            
    5.             @Override
    6.             public void onClick(View v) {
    7.                 InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
    8.                 imm.hideSoftInputFromWindow(name.getWindowToken(),0);
    9.                 name.setInputType(0);
    10.             }
    11.         });
    12.  
     
  5. Sam Voss

    Sam Voss Android Enthusiast
    Rank:
    None
    Points:
    43
    Posts:
    367
    Joined:
    Jun 25, 2010

    Jun 25, 2010
    367
    44
    43
    Programmer, in school
    Wisconsin
    Out of curiosity, how come you want no suggestions and no keyboard on an edittext?
     
    hyungjungsoh likes this.
  6. hyungjungsoh

    hyungjungsoh Newbie
    Thread Starter
    Rank:
    None
    Points:
    16
    Posts:
    18
    Joined:
    Nov 7, 2010

    Nov 7, 2010
    18
    1
    16
    남한
    T_T My grades heavily depend on it. I mean my professor said he is annoyed when ever he sees the keyboard and the suggestions thingy, so I had to hide it during the presentation. I know it's A BIG SIN especially when it's going to be installed on a real device. But since it's just on the emulator, I guess it will be okay.
     
  7. Sam Voss

    Sam Voss Android Enthusiast
    Rank:
    None
    Points:
    43
    Posts:
    367
    Joined:
    Jun 25, 2010

    Jun 25, 2010
    367
    44
    43
    Programmer, in school
    Wisconsin
    ah, that makes sense, to do this, just change the settings on the emulator? you can turn off the soft keyboard etc in settings
     
    hyungjungsoh likes this.
  8. hyungjungsoh

    hyungjungsoh Newbie
    Thread Starter
    Rank:
    None
    Points:
    16
    Posts:
    18
    Joined:
    Nov 7, 2010

    Nov 7, 2010
    18
    1
    16
    남한
    Yeah... But I find it a bit tedious because the emulator's settings seem to restart everytime my app gets re-installed (as I am currently in the process of testing it). So I tried write it on code instead.
     
  9. id0001

    id0001 Well-Known Member
    Rank:
    None
    Points:
    38
    Posts:
    142
    Joined:
    Apr 20, 2010

    Apr 20, 2010
    142
    23
    38
    Student.. also software developer
    Netherlands
    you can make the emulator not reset all your user data at startup. There is a checkbox somewhere when you start the emulator.
     
    hyungjungsoh likes this.
  10. hyungjungsoh

    hyungjungsoh Newbie
    Thread Starter
    Rank:
    None
    Points:
    16
    Posts:
    18
    Joined:
    Nov 7, 2010

    Nov 7, 2010
    18
    1
    16
    남한
    There is? O_O I didn't notice that... Anyways, thank you so much.
     

Share This Page

Loading...