I have a dialog containing a time picker. On all my other phones, all is OK I click on the button , the dialog (containing time picker) appear. Than I set the time.
On the Nexus 7 version android 4.2. In the landscape mode, when I click on the button the dialog appear and the keyboard appears automatically. I didn't clicked on TimePicker
yet.
Any one know why I am getting this issue on Nexus7.
Edit: The code is given below
private DatePicker mDatePicker;
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
mDatePicker = (DatePicker) view.findViewById(R.id.date_picker);
mDatePicker.init(mDate.get(Calendar.YEAR), mDate.get(Calendar.MONTH), mDate.get(Calendar.DAY_OF_MONTH), this);
mDatePicker.clearFocus();
}
Make the layout
containing the time picker focusable. And request focus to this layout
. Then the DatePicker
won't get focus and the keyboard will not be displayed.
Have you ever tried to hide your keyboard on button click after your dialog appears? Something like this :
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
I ran into this same issue with me calling for the SoftInputMode
(Keyboard) on one Activity
in my app and it appearing on all the other Activities
. So, I finally had to add android:windowSoftInputMode="stateAlwaysHidden"
to my manifest
file on the activities
I did not want the SoftInputMode
(Keyboard) to pop up. This got rid of the keyboard popping up. Here is what my manifest
Activity
looks like:
<activity
android:name=".GMax3Main"
android:label="@string/app_name"
android:windowSoftInputMode="stateAlwaysHidden">
<intent-filter>
<action android:name="com.medeasy.GMax3.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
you can also try to disable it in Manifest:
<activity
android:name=".activity.SampleActivity"
android:configChanges="keyboardHidden|orientation"
/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With