本文整理汇总了Java中android.widget.EditText.getTag方法的典型用法代码示例。如果您正苦于以下问题:Java EditText.getTag方法的具体用法?Java EditText.getTag怎么用?Java EditText.getTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.EditText
的用法示例。
在下文中一共展示了EditText.getTag方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validateEditText
import android.widget.EditText; //导入方法依赖的package包/类
public static boolean validateEditText(final EditText editText, final ValidationEngine validationEngine) {
if(editText.getTag() == null) {
ArgusLogger.w(TAG, "Not performing validations for this EditText");
}
boolean allWell = true;
// get validations for tag
List<Validation> validations = validationEngine.getValidationsByKey(editText.getTag().toString());
if(validations != null && !validations.isEmpty()) {
String errors = ValidationEngine.validate(editText.getText().toString(), validations);
if(!TextUtils.isEmpty(errors)) {
editText.setError(errors);
allWell = false;
}
}
return allWell;
}
示例2: validateAndApplyArgNameChange
import android.widget.EditText; //导入方法依赖的package包/类
private void validateAndApplyArgNameChange(EditText argNameField) {
ArgInfo argInfo = (ArgInfo) argNameField.getTag();
String newName = argNameField.getText().toString();
newName = mVariableNameManager.makeValidName(newName, null);
if (newName != null && mVariableNameManager.getExisting(newName) == null) {
argInfo.name = newName;
}
}
示例3: dismissKeyBoard
import android.widget.EditText; //导入方法依赖的package包/类
/**
* Allows to hide keyboard and rename a project file by given view
* from the list of projects.
*
* @param v View that represents a project from the list.
* @param hide If true - hides the keyboard.
* @param done If true - renames given project file.
*/
private void dismissKeyBoard(View v, boolean hide, boolean done) {
logi("dismissKeyBoard() :: ");
int pos = (Integer) v.getTag(R.id.positionId);
logi("dismissKeyBoard() :: pos = " + pos + " currentEditableRow=" + currentEditableRow);
InputMethodManager imm = (InputMethodManager) mProjectActivity.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(v.getApplicationWindowToken(), 0);
if(hide) {
hideEditTextView(v);
}
if(done) {
EditText ed = (EditText) v;
pos = (int) ed.getTag(R.id.positionId);
String newName = ed.getText().toString();
Project p = mProjects.get(pos);
if(newName.length() > 0) {
if(p.name.compareToIgnoreCase(newName) != 0) {
mProjectActivity.renameFile(p.filePath, newName);
}
}
}
}