String txt = StrUtils.checkEditString(edit_speak_content, getResources().getString(R.string.note_edit_text_non_tips));
StrUtils.checkString(txt.length() <= 500, getResources().getString(R.string.note_edit_text_tips));
StrUtils类
public static String checkEditString(TextView editText, String msg4Null) throws InputNullException {
String input = editText.getText().toString();
if (TextUtils.isEmpty(input)) {
// throw new InputNullException("editText input is Null");
throw new InputNullException(msg4Null);
}
return input;
}
public static void checkString(boolean flag, String msg4Null) throws InputNullException {
if (!flag) {
throw new InputNullException(msg4Null);
}
}