Flickering in Android while keyboard dismissal? - android

I am having issue with Android Tablet.
I have created a runtime views as shown in Attachment(tab_before_error.png), when user clicks on Edittext then keyboard appears, after typing something I am making some operations in aftertextchanged callback. When I dismiss the Keyboard, there is Flickering as shown in attachment(tab_error.png).
What's the issue, why the system not able to render the UI immediately once the keyboard dismissal.

try to put the following line in ur activity tag in manifest..
android:windowSoftInputMode="stateHidden|adjustNothing"

Related

Hide Android keyboard [duplicate]

This question already has answers here:
How to stop EditText from gaining focus when an activity starts in Android?
(54 answers)
Closed 4 years ago.
I have been trying to hide the keyboard when user enters an activity,i checked and tried various ways and method but the one I lost see is hide keyboard on button click. I don't want the keyboard to hide on only button, I want it to be hidden when the activity starts. I also tried to put the code in an onCreate method but still the same.another on I saw on Android arsenal was to click on any part of the screen to hide the keyboard was nice but still I still prefer the keyboard hidden when the activity starts, please is there any way hiding the keyboard when the activity starts?
Your solution is here
There's yet another point of contention to be aware of. By default, Android will automatically assign initial focus to the first EditText or focusable control in your Activity. It naturally follows that the InputMethod (typically the soft keyboard) will respond to the focus event by showing itself. The windowSoftInputMode attribute in AndroidManifest.xml, when set to stateAlwaysHidden, instructs the keyboard to ignore this automatically-assigned initial focus.
<activity
android:name=".MyActivity"
android:windowSoftInputMode="stateAlwaysHidden"/>
Almost unbelievably, it appears to do nothing to prevent the keyboard from opening when you touch the control (unless focusable="false" and/or focusableInTouchMode="false" are assigned to the control). Apparently, the windowSoftInputMode setting applies only to automatic focus events, not to focus events triggered from touch events.
Therefore, stateAlwaysHidden is VERY poorly named indeed. It should perhaps be called ignoreInitialFocus instead.
Write this line on oncreate method
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

how to set InputType to InputType.TYPE_CLASS_NUMBER in Android Version 7.0 (nougat) and above

I have created Custom Edittext in which i set the InputType as this.setInputType(InputType.TYPE_CLASS_NUMBER); but the problem is it working perfectly on below 7.0(nougat) but above 7.0 it show me alphanumeric keyboard.
one another weird thing happen is when I touch the EditText, I quickly get the soft numerical keyboard, but in less than a second it automatically changes to regular soft keyboard showing all letters. also when keyboard is open, than ill press back button, than keyboard close, but when i re-enter in Edittext. keyboard is not open until i click on onther edittext then current edittext
Is this issue in Nougat or I am doing something wrong
For information i have used code to setSoftInputMode to ADJUST PAN
setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN
|WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
and to set Numeric keypad use this.setInputType(InputType.TYPE_CLASS_NUMBER);
Edited -
when i remove -
setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN
|WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
from activity every thing work fine( number keypad open at number edittext , alphanumerical keypad open at alphanumerical edittext ) except the content not goes up-direction means keypad hide edittext(because ignorance of this property SOFT_INPUT_ADJUST_PAN)
Help appreciated thanks
I tried to use setInputType(InputType.TYPE_CLASS_NUMBER) on devices 7+ and didn't see the behaviour that you described. Looking for another thread, runnable or any callback which changing InputType of your EditText after opening or simultaneously.
Try setting softInputMode in your Manifest file, it might give you your desired behavior.
<activity
android:name=".YourActivity"
android:label="#string/app_name"
android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />

Redrawing UI when keyboard closes

I have a ScrollView with few EditText fields.When tapped on editext field, keyboard appears,
But while closing the keybaord, the UI elements that were behind the keybaord are redrawn.
The UI elements that were behind the keyboard just disappears for a moment while the keyboard is closing and reappears again.
I can use adjustPan,adjustResize in manifest file, but this will move entire screen up. ( I have master details view with details view in scrollview ).So, I am not using it.
Can someone please let me know if there is any other approach to achieve this.
Thanks in advance.
Edit : i am using android 4.2.2
try this in your Activity tag inside Manifest file
android:windowSoftInputMode="stateAlwaysHidden|adjustPan"

Stop showing softkeyboard in WebView

Is there a way to prevent the softkeyboard to show up in a WebView? My app is attached to a scanner which simulates keyboard entry (that works so far), so the softkeyboard is only annoying when it occupies the screen.
The Nullkeyboard from the Playstore does the trick, but in certain cases I would like to enable the keyboard again.
If it helps, I can control the content of the webpage being shown. Would like to avoid programming a full input method.
In your manifest, on the activity, use android:windowSoftInputMode="stateAlwaysHidden" and the soft keyboard should never be displayed.

Keyboard not showing on activity start: Android phones

I have an edittext in my activity, and on activity and on create view
I am setting the focus on the activity. while setting focus, I am also
trying to show the keyboard. It works on some devices, but on others it
just doesn't show.
I tried to step through the code and found that the view is not created, when
the show keyboard is called. Maybe that is the reason.
I am not sure what the problem is. Is there a way to make sure, that if a edit text
is in focus, the keyboard shows up on app start.
Thanks,
You can try to show the Soft Keyboard by calling the following line during onCreate:
getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);
I hope that helps.
In your AndroidManifest.xml, add this attribute to the <activity> tag for the Activity you want the keyboard shown:
android:windowSoftInputMode="stateVisible"

Categories

Resources