android - EditText: suppress soft keyboard but allow selection and cursor? -


i want display edittext edited selecting parts of , pressing buttons insert new values. (the values long hex strings don't want user have type.) therefore, want suppress display of soft keyboard unless user deliberately calls up.

this question describes same requirement, accepted answer not work on android 5.1. when input mode changed inputtype.type_null, edittext disables all editing functionality, not soft keyboard. there's no cursor, no click-drag selection, etc.

overriding oncheckistexteditor() suggested in this answer behaves same way.

is there way accomplish on android 5?

this added in api 21:

edittext edittext = (edittext) findviewbyid(r.id.edittext); edittext.setshowsoftinputonfocus(false); 

according grepcode, method has been present hidden since version 4.1.1. can annotate method calls @targetapi(build.version_codes.lollipop), , protect call if(build.version.sdk_int >= build.version_codes.jelly_bean).


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -