Created
August 4, 2016 01:06
-
-
Save shihabmi7/777bb978765d5e5de0f076947058b969 to your computer and use it in GitHub Desktop.
Edittext Ime , Hide keyboard
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EditText | |
android:id="@+id/et_go" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_centerHorizontal="true" | |
android:layout_centerVertical="true" | |
android:inputType="text" | |
android:imeOptions="actionGo" | |
android:hint="@string/hnt_et_go" /> | |
et_go.setOnEditorActionListener(new OnEditorActionListener() { | |
@Override | |
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { | |
if(actionId==EditorInfo.IME_ACTION_GO){ | |
// Creating uri to be opened | |
Uri uri = Uri.parse("http://"+etColor.getText().toString()); | |
// Creating an intent to open the uri | |
Intent intent = new Intent(Intent.ACTION_VIEW, uri); | |
// Opening the uri in an activity | |
startActivity(intent); | |
} | |
return false; | |
} | |
}); | |
// Hide the soft keyboard | |
The following code snippet will help you to hide or dismiss the soft keyboard from the screen and take the input focus out form the editable view. | |
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); | |
imm.hideSoftInputFromWindow(view.getWindowToken(), 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment