A quick question:
I am getting the error : cannot convert from String to Editable. Here is the code :
Credential.getInstance().UserName = preferences.getString("UserName", "invalid value");
Credential.getInstance().Password = preferences.getString("UserName", "invalid value");
I've also tried casting like following:
Credential开发者_JS百科.getInstance().UserName = (Editable) preferences.getString("UserName", "invalid value");
Credential.getInstance().Password = (Editable) preferences.getString("UserName", "invalid value");
This time I am getting error : Cannot cast from String to Editable.
What to do?
For anyone interested in converting a String to Editable
Editable.Factory.getInstance().newEditable("myString");
From the docs, append is
Convenience for append(String.valueOf(text)).
Surely:
Credential.getInstance().UserName.append(preferences.getString("UserName", "invalid value"));
The API with the answers:
http://developer.android.com/reference/android/text/Editable.html
精彩评论