I have a problem with the keyboard. I've research all the "Stackoverflow", I've tested million of different methods. And still cannot to make the keyboard hidden, when the "Dialog" shows up. May be anybody has a 10000% working solution?
public class ConfirmDialog extends DialogPreference implements OnClickListener{
public ConfirmDialog(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
setPositiveButtonText(R.string.b_ok);
setNegativeButtonText(R.string.b_cancel);
}
protected View onCreateDialogView(){
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View createdv = inflater.inflate(R.layout.confirm_dialog, null);
//Here I've tried to hide a keyboard!!!!!!!!!!!!!!
((EditText) createdv.findViewById(R.id.confirm_name)).setOnFocusChangeListener(new View.OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
if(hasFocus)
{
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
}
// TODO Auto-generated method stub
}
});
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);}
}
Solved… In XML document right in front of EditText tag I've added…
<LinearLayout android:focusable="true"
android:focusableInTouchMode="true"
android:layout_width="0px"
android:layout_height="0px" />
I've read it here.