本文整理匯總了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);
}
}
}
}