Reputation: 923
I cannot get the softkeyboard to display on my samsung phone while testing an autocompletetext control in Eclipse. I hit to physically touch the autocompletetext control to bring up the keyboard. Is there something different about AutoCompleteText controls that don't allow displaying a soft keyboard. Below is my code in the onCreate method of my activity. I will appreciate any help.
autoComplete = (AutoCompleteTextView) findViewById(R.id.suggest);
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(autoComplete, InputMethodManager.SHOW_FORCED);
if (imm != null){
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
}
// imm.toggleSoftInput(0, 0);
autoComplete.addTextChangedListener(new TextWatcher(){
public void afterTextChanged(Editable editable) {
// TODO Auto-generated method stub
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
// TODO Auto-generated method stub
}
public void onTextChanged(CharSequence s, int start, int before, int count) {
String newText = s.toString();
int len = newText.length();
// Toast.makeText(getApplicationContext(), "Text changed count = " + String.valueOf(len), Toast.LENGTH_LONG).show();
if(len > 1)
new getData().execute(newText);
}
});
Upvotes: 1
Views: 121
Reputation: 181
try this
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
This will force the keyboard to show
Upvotes: 1