Written by Jefri Pakpahan / staff.blog.ui.ac.id, Java

Posted with : Android, Java, Keyboard


Android menampilkan dan menyembunyikan keyboard.

sebelumnya import terlebih dahulu

1
2
3
4
import android.view.inputmethod.InputMethodManager;

InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);

atau

1
2
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);

atau jika ingin ingin selalu memunculkan keyboard pada suatu window edit AndroidManifest.xml

1
<activity android:name=".HomeActivity" android:label="Home" android:windowSoftInputMode="stateAlwaysVisible">

*Catatan biar ga lupa* :)



blog comments powered by Disqus