{"action":"created","issue":{"url":"https://api.github.com/repos/sanathp/DatabaseManager_For_Android/issues/3","labels_url":"https://api.github.com/repos/sanathp/DatabaseManager_For_Android/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/sanathp/DatabaseManager_For_Android/issues/3/comments","events_url":"https://api.github.com/repos/sanathp/DatabaseManager_For_Android/issues/3/events","html_url":"https://github.com/sanathp/DatabaseManager_For_Android/issues/3","id":55290100,"number":3,"title":"Close soft keyboard upon executing SQL query or tapping elsewhere","user":{"login":"SpencerY2","id":5052010,"avatar_url":"https://avatars.githubusercontent.com/u/5052010?v=3","gravatar_id":"","url":"https://api.github.com/users/SpencerY2","html_url":"https://github.com/SpencerY2","followers_url":"https://api.github.com/users/SpencerY2/followers","following_url":"https://api.github.com/users/SpencerY2/following{/other_user}","gists_url":"https://api.github.com/users/SpencerY2/gists{/gist_id}","starred_url":"https://api.github.com/users/SpencerY2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SpencerY2/subscriptions","organizations_url":"https://api.github.com/users/SpencerY2/orgs","repos_url":"https://api.github.com/users/SpencerY2/repos","events_url":"https://api.github.com/users/SpencerY2/events{/privacy}","received_events_url":"https://api.github.com/users/SpencerY2/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-01-23T14:56:57Z","updated_at":"2015-02-06T06:44:27Z","closed_at":null,"body":"It would be nice if you could auto-dismiss the soft keyboard when the user clicks \"Submit Query\" or if they tap anywhere that is not a textView.\r\n\r\nThis code can be used:\r\n\r\n    public void setUpHideKeyboardListeners(View view) {\r\n\r\n        //Set up touch listener for non-text box views to hide keyboard.\r\n        if(!(view instanceof EditText)) {\r\n\r\n            view.setOnTouchListener(new View.OnTouchListener() {\r\n\r\n                public boolean onTouch(View v, MotionEvent event) {\r\n                    hideSoftKeyboard(VoiceFragment.this.getActivity());\r\n                    return false;\r\n                }\r\n\r\n            });\r\n        }\r\n\r\n        //If a layout container, iterate over children and seed recursion.\r\n        if (view instanceof ViewGroup) {\r\n\r\n            for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {\r\n\r\n                View innerView = ((ViewGroup) view).getChildAt(i);\r\n\r\n                setUpHideKeyboardListeners(innerView);\r\n            }\r\n        }\r\n    }\r\n\r\n\r\nCalled as\r\n\r\nsetUpHideKeyboardListeners(view);\r\n\r\nin OnCreateView();\r\n\r\nTo programmatically hide the keyboard:\r\n\r\n    public static void hideSoftKeyboard(Activity activity) {\r\n        View currentFocusView = activity.getCurrentFocus();\r\n        if (currentFocusView != null) {\r\n            InputMethodManager inputMethodManager = (InputMethodManager)  activity.getSystemService(Activity.INPUT_METHOD_SERVICE);\r\n            inputMethodManager.hideSoftInputFromWindow(currentFocusView.getWindowToken(), 0);\r\n        }\r\n    }\r\n\r\nand call it as something like:\r\n\r\n        hideSoftKeyboard(this);\r\n\r\nor\r\n\r\n        hideSoftKeyboard(this.getActivity());\r\n\r\n\r\n\r\nThanks a lot for this contribution!!\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/sanathp/DatabaseManager_For_Android/issues/comments/73189895","html_url":"https://github.com/sanathp/DatabaseManager_For_Android/issues/3#issuecomment-73189895","issue_url":"https://api.github.com/repos/sanathp/DatabaseManager_For_Android/issues/3","id":73189895,"user":{"login":"sanathp","id":7811835,"avatar_url":"https://avatars.githubusercontent.com/u/7811835?v=3","gravatar_id":"","url":"https://api.github.com/users/sanathp","html_url":"https://github.com/sanathp","followers_url":"https://api.github.com/users/sanathp/followers","following_url":"https://api.github.com/users/sanathp/following{/other_user}","gists_url":"https://api.github.com/users/sanathp/gists{/gist_id}","starred_url":"https://api.github.com/users/sanathp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sanathp/subscriptions","organizations_url":"https://api.github.com/users/sanathp/orgs","repos_url":"https://api.github.com/users/sanathp/repos","events_url":"https://api.github.com/users/sanathp/events{/privacy}","received_events_url":"https://api.github.com/users/sanathp/received_events","type":"User","site_admin":false},"created_at":"2015-02-06T06:44:27Z","updated_at":"2015-02-06T06:44:27Z","body":"Its just some random id you have assign to that layout.\r\nRemove that line and try once . If that does not work write a function as given in that stackoverflow url and set the value.\r\n"}}