Dismiss Keyboard in Android Automatically [duplicate] - java

This question already has answers here:
Disable keyboard on EditText
(18 answers)
Closed 1 year ago.
I am trying to create calculator application in Android Studio using Java, I have EditText for showing result. When I focus this input Keyboard is showing. But I don't want to see keyboard in focus event as in normal calculator. Is there any way to solve this, or can I use other element either than EditText, I have used getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); in OnCreate method, but it doesn't work

EditText is desired to.. edit text. do you want to allow user for editing result?
if not just replace EditText with TextView and then any keyboard won't show up
if you still want this field to be editable then take a look a THIS QA, you will find there plenty of methods for blocking keyboard pop up automatically

Related

Change functionality of back button [duplicate]

This question already has answers here:
Android - How To Override the "Back" button so it doesn't Finish() my Activity?
(10 answers)
Closed 5 years ago.
I have a recyclerView in a fragment which I use it to show some items. When selecting these items I change my toolbar title to number of selected items and also I change menu options. how can I make pressing back button cancel the selection operation?
You override the
onBackPressed()
Method and do what you want there. Any back key press will trigger this function and you'll be able to use your logic

Changing Text dynamically in Swing [duplicate]

This question already has answers here:
Value Change Listener to JTextField
(14 answers)
Closed 5 years ago.
I have a Swing program that uses JTextField's text to draw a string in canvas. The problem is it only does so after the entire text in the JTextField has been entered. How can I change the text in GUI dynamically, meaning each character that is being typed or deleted in JTextField is immediately drawn or deleted in GUI? I've already implemented MVC and have a bunch of actionListeners. Just not sure on what I should use the action listener for this. Scanner? Could somebody please point me in the right direction? Thank you.
It's possible to use DocumentListener to reach the goal. The details is at Value Change Listener to JTextField
Changes like "insert", "remove" can be detected at the listener, no need to press Enter to trigger them.

Make EditTexts not linked? [duplicate]

This question already has answers here:
Android Edittext question, replace keypad enter with done
(5 answers)
Closed 5 years ago.
I made an app with several EditTexts in my layout, and when I enter Something into the first, the keyboard will show a "next" arrow, to type in the next EditText. But I don't want that to happen. I want it to show a "finished" symbol, and exit the keyboard when I press it. How can I do that?
Add android:imeOptions="actionDone" to your EditText to acheive this.

AlertDialog shows wrong in landscape [duplicate]

This question already has answers here:
Disabling the fullscreen editing view for soft keyboard input in landscape?
(11 answers)
Closed 7 years ago.
I launch an AlertDialog in Android with an EditText field. When I use portrait orientation runs fine, but when I change to landscape the keyboard hides my alert. How I can I solve this?
In landscape, some android devices will cause the keyboard to fullscreen when the focus is on an editable feature of the layout (in your case, EditText).
You can flag the EditText to not fullscreen the keyboard in landscape in two ways:
XML: android:imeOptions="flagNoExtractUi"
Code: myEditText.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);

Disable Print Screen Button [duplicate]

This question already has answers here:
Disable Screenshot of my Swing Window
(5 answers)
Closed 9 years ago.
Can I disable the print screen button, while my application is on? Can we use the print screen button as one of the coded keyboard inputs, and equal it to do nothing?
There's no way to do this without affecting the Operating System settings via registry edits, etc.
A user can always unfocus your application, and press print screen taking a capture of the whole screen otherwise.

Categories

Resources