我正在使用getText()
和getEditableText()
中的修改在本机android应用程序中设置自定义EditText视图,我正在这些方法中对纯文本进行加密,并且遇到了某些设备的问题。
如果在类中实现了getEditableText()
,则该问题将无法在某些设备上通过EditText View显示文本。
我尝试从getEditbaleText()
返回加密值Null值和静态值。
如果我未实现getEditableText()
,它将直接调用父类方法。
//ByDefault method
@Override
public Editable getEditableText() {
return super.getEditableText();
}
//Modified method
//Encrypted Value
1)@Override
public Editable getEditableText() {
try {
CharSequence encryptedText = super.getEditableText();
if (encryptedText != null) {
Context context = getContext();
SecureSDKImpl_inner secureSDKImpl_inner = null;
if (context != null) {
secureSDKImpl_inner = new SecureSDKImpl_inner(context);
if (secureSDKImpl_inner != null) {
encryptedText = secureSDKImpl_inner.EncryptText(encryptedText.toString());
}
} else {
Log.d(TAG, null);
return null;
}
} else {
Log.d(TAG,"secureSDKImpl_inner is null");
return null;
}
return new Editable.Factory().newEditable(encryptedText);
} catch (Exception e) {
e.printStackTrace();
Log.e(TAG, e.toString());
return null;
}
}
//try to retun null
2)@Override
public Editable getEditableText() {
super.getEditableText();
Editable editable=null;
return editable;
}
//try to return null
3) @Override
public Editable getEditableText() {
CharSequence encryptedText="";
return new Editable.Factory().newEditable(encryptedText);
}
在某些设备上无法在EditText上键入单个字符。主要发生在Gionee,MIUI,EMUI。
我期望从中获取null或加密值
getEditableText()
注意-getText()