android-softkeyboard

OnBackPressed with a SoftKeyboard open

让人想犯罪 __ 提交于 2019-12-02 02:21:31
I want to finish an activity when the soft keyboard is open, I want to override the back event of the soft keyboard and finish the activity. I'm using this but it's not working , any Idea ? public boolean onKeyPreIme(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) { this.finish(); return false; } return super.dispatchKeyEvent(event); } onKeyDown() and onBackPressed() doesn't work for this case. You have to use onKeyPreIme . Initially, you have to create custom edit text that extends EditText . And then you have to implement

How do I make my own keyboard for an app in android?

荒凉一梦 提交于 2019-12-02 00:59:39
I am currently working on an app that requires a keyboard in a different language (Specifically Hebrew). The problem is that I don't know where to begin. I don't want the user to have to go onto an app store, and install a separate app that has more languages in it just to use my app. I only want the keyboard to be available in my app (i.e. it shouldn't effect anything outside my specific app). The way I am doing it right now is to create it as part of the main layout, and just make it visible whenever the user clicks on the Edit Text. The problem with this approach is I can't get the size of

Show/Hide Soft Keyboard event in Fragment

戏子无情 提交于 2019-12-01 23:36:52
There are a lot of posts about finding a show/hide soft keyboard event. I find myself in a situation where I need to change an icon based on the soft key status, in a fragment. I tried to implement onMeasure, but I can't override that in my fragment. Is there a (relative) painless way of getting a clean show/hide soft keyboard event in my fragment or should I abondon ship? Art Sadly but true - android do not have native on software keyboard show event. One the way handle fact that keyboard is hidden is to check entered symbols and back button press (for example textEdit will receive even back

Android: softkeyboard not showing up

被刻印的时光 ゝ 提交于 2019-12-01 21:06:27
问题 I have 2 EditTexts in the MainActivity Layout. If i run the application normally the 1st EditText gets focused but the softkeyboard is not openned. but when i used this: public class TestingActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); EditText et1 = (EditText) findViewById(R.id.editText1); EditText et2 = (EditText) findViewById(R.id.editText2); et2.requestFocus(); InputMethodManager

How to focus and show soft keyboard when a EditText is shown in action bar?

大憨熊 提交于 2019-12-01 19:16:23
I used ActionBarSherlock to create ActionBar it has a search button that shows an AutoCompleteEditText ( SHOW_AS_COLLAPSIBLE_ACTION_VIEW ) When Search button is clicked, EditText is shown, i want EditText to get focus and thus show the Soft Keyboard, as it's expanded this is the code @Override public boolean onCreateOptionsMenu(Menu menu) { getSupportMenuInflater().inflate(R.menu.activity_main, menu); boolean isLight = true; // Add Search button int menuItemId = menu .add("Search") .setIcon( isLight ? R.drawable.ic_search_inverse : R.drawable.ic_search) .setActionView(R.layout.collapsible

Android: softkeyboard not showing up

烈酒焚心 提交于 2019-12-01 18:31:50
I have 2 EditTexts in the MainActivity Layout. If i run the application normally the 1st EditText gets focused but the softkeyboard is not openned. but when i used this: public class TestingActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); EditText et1 = (EditText) findViewById(R.id.editText1); EditText et2 = (EditText) findViewById(R.id.editText2); et2.requestFocus(); InputMethodManager mInputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);

How to focus and show soft keyboard when a EditText is shown in action bar?

扶醉桌前 提交于 2019-12-01 18:29:32
问题 I used ActionBarSherlock to create ActionBar it has a search button that shows an AutoCompleteEditText ( SHOW_AS_COLLAPSIBLE_ACTION_VIEW ) When Search button is clicked, EditText is shown, i want EditText to get focus and thus show the Soft Keyboard, as it's expanded this is the code @Override public boolean onCreateOptionsMenu(Menu menu) { getSupportMenuInflater().inflate(R.menu.activity_main, menu); boolean isLight = true; // Add Search button int menuItemId = menu .add("Search") .setIcon(

Display Keyboard for EditText in Emulator (GenyMotion) Android 4.3

若如初见. 提交于 2019-12-01 15:45:45
Does anybody know how to display the keyboard in the emulator when the EditText field has focus. I have tried so many solutions but none of them work. I am working in android 4.3 Jelly Bean. The Emulator I am using is GenyMotion. I would also like to know how to hide the keyboard when the EditText field loses focus. I assume however if the keyboard does not appear in the emulator it won't appear when testing on the device. Any help much appreciated Just check the details of your emulator. Soft Keyboard won't be displayed if you have checked the option "Hardware Keyboard Present", uncheck that

Detect input from software or hardware keyboard

怎甘沉沦 提交于 2019-12-01 14:47:12
I'm working in an Android app that must use a RFID tag reader. I'm using this reader as an extra device connected in my microUSB with an OTG wire. Android is detecting this device as an input keyboard. I would like to know if I can programatically detect when a user does an input with this reader. So basically I must differenciate the input from my softkeyboard or this reader. I searched a lot but I can't find a solution any help would be so appreciated. Thank you very much. yourEditText.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent

How to change keyboard layout by swipe left or right space key in custom keyboard

故事扮演 提交于 2019-12-01 14:31:47
I made an android custom keyboard . I want to use swiping on Space key on the keyboard for changing keyboard layout to show next language layout. How can i do that? I used bellow class: public class KeyboardIMS extends InputMethodService implements KeyboardView.OnKeyboardActionListener { ...} You can do this by override touchEvent like this : @Override public boolean onTouchEvent(MotionEvent e) { float x = e.getX(); float y = e.getY(); switch (e.getAction()) { case MotionEvent.ACTION_DOWN: mIsDown = true; break; case MotionEvent.ACTION_MOVE: float dx = x - mPreviousX; float dy = y - mPreviousY