【问题标题】:Validate TextEdit in Tasker在 Tasker 中验证 TextEdit
【发布时间】:2016-05-29 06:24:32
【问题描述】:

如何在 tasker 场景中验证文本编辑字段。

要求:我在 tasker 场景中有一个文本编辑字段和一个提交按钮。 单击提交按钮后,我需要验证并查看 textedit 字段是否为空。

我尝试了什么:

  1. 创建一个变量并在每次修改 textedit 时更新它。
  2. 提交时,检查变量是否为空。(使用匹配空)
  3. 上述方法无效。

谁能告诉我如何验证 textedit 字段。 例如:如果 %Textedit_variable ~ null

【问题讨论】:

    标签: android textedit tasker


    【解决方案1】:

    你需要做的是这个

    1. 单击按钮时,将 textedit 中的文本提取到字符串中。

    2. 试试这样的:

      String s= mytextedit.getText().toString();

    3. 使用以下方法查看字符串是否为空:

    if(s.equals("")){ //the user hasn't entered anything }

    希望这会有所帮助:)

    【讨论】:

    • 感谢您的回复。你能解释一下如何在Tasker中实现上述内容吗?
    • 您只需将上述代码放入按钮的onClick()中即可。
    【解决方案2】:

    https://groups.google.com/forum/#!topic/tasker/bxP5UjEKH4I

    我从上面讨论的回复中知道了。

    • 我使用 testElement 将 textEdit 字段的当前值存储到 %TextEdit_Var
    • 单击按钮时,我在按钮的点击操作中使用以下条件:

    If %TextEdit_Var ~ *TextEdit_Var

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-09
      • 2021-11-20
      • 1970-01-01
      • 2011-06-10
      • 1970-01-01
      相关资源
      最近更新 更多