How to avoid keyboard from appearing with starting FilePickerActivity - android

I have a button in an activity that starts a FilePickerActivity. Everything works as expected except for the soft keyboard that appears right when the activity starts. I've already tried using the following code line but I can't use it INSIDE the FilePickerActivity because I can't modify it: getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
Is there an extra that I can put in the intent or something to tell that FilePickerActivity to NOT open the soft keyboard on start?
Thanks in advance!

Add this line in your activity tag in manifest:
android:windowSoftInputMode="stateAlwaysHidden"

use android:windowSoftInputMode="stateHidden" in manifest activity tag

Related

How to stop activity resizing/pushing up on keyboard open in dialog?

I have an activity, which should react on keyboard opening, so in the manifest, it has an attribute
android:windowSoftInputMode="adjustResize"
Also, this activity can start a dialog, which has EditText. When it starts dialog, keyboard is shown, dialog (which is ok) and activity (not ok) are pushed up. It looks ugly and I want disable pushing of the activity up when dialog is visible.
Is there any beautiful way to solve this problem?
Currently I am changing softInputModeat runtime, it works but it's annoying.
Also why the hell scrollview scroll not working with adjustPan?
Try using adjustPan instead of adjustResize.
Solution:
Firstly,
remove android:windowSoftInputMode="adjustResize" do not even change it from runtime.
Secondly, use <NestedScrollView> and add an attribute to it called:
isScrollContainer="true"
Try it and update here if it is exactly how you need.
use this in your activity tag on manifest:
android:configChanges="orientation|screenSize"
android:windowSoftInputMode="stateHidden|adjustPan"

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"

how to remove selected state from an edittext when an activity launches in android?

In my application I have an activity that has an edittext in it, when the activity launches the edit text automatically is given a selected state and the keyboard appears immediately, the problem here is when this happens other parts of the activity the user sees become hidden, what I would like is that when the activity starts there is no focus on the edittext so that user can view other elements on the page and then decide if they would like to select the edittext and launch the keyboard, any help would go a long way thanks!
use android:windowSoftInputMode="stateHidden" in your manifest.xml file as
<activity android:name=".YourActivity" android:label="" android:theme="#android:style/Theme.NoTitleBar" android:windowSoftInputMode="stateHidden"/>
hope this help
I figured it out, you actually have to go into the manifest file and place android:windowSoftInputMode="stateHidden" in the activity tag for the activity you dont want the keyboard to automatically show up on, took some extensive searching but found it!

Android default onfocus on autofocus and editview,How to remove that?

In my application I have a autocomplete in first activity and some edittext in second activity.
When I run my code in emulator it works fine and I am not seeing any virtual keyboard on screen when program is excecuted.
But when I deploy it in device when the application loads, onfocus is directly on autocomplete and a keyboard pops out, and also when I navigate from first activity to second activity onfocus is on first edittext and keyboard pops out.
I want to disable this onfocus on all the page. how to do that ?
Take a look at this question:
Stop EditText from gaining focus at Activity startup?
That worked for me... I just put this line in the activity definition on Manifest.
<activity
...
android:windowSoftInputMode="stateHidden" >
</activity>

how to disappear keyboard onCreate Method?

friends,
i have a EditText on simple activity with a button.
when every i move from one activity to this acivity focus is automatically set to EditText and keyboard appears in phone.
i dont want to open keyboard untill i click on editText.
can any one guide me what should i do?
any help would be appriciated.
You can use the following line of code to make sure the keyboard doesn't pop up when the activity starts and only pops up when a user clicks into an EditText
Place it in the onCreate method of your activity
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
EditText.setInputType(InputType.TYPE_NULL);
You can also pass the same thing in AndroidMenifest file for that particular activity like:
<activity
android:name="Activity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" >
</activity>
This will also work for you :)

Categories

Resources