Click here to Skip to main content
15,885,244 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I use this in Activity and it's worked
Java
@Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
            if (getCurrentFocus() != null) {
                  InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                  imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
                }
        return super.dispatchTouchEvent(ev);
    }


...how to hide in fragment?

Java
public class Fragment1 extends Fragment {
     
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View rootView = inflater.inflate(R.layout.fragment1,null);
                	
               		 EditText Inv = (EditText) getView().findViewById(R.id.edt1);
		
                	return rootView;
	}	
}


thanks a lot for your help
Posted
Updated 24-Sep-14 18:47pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900