【发布时间】:2016-08-21 07:53:24
【问题描述】:
我正在为 Taker Android 应用程序制作插件。该插件本质上将允许人们使用自己的设置值动态创建列表和卡片视图。
我认为允许使用 Tasker 变量来设置列表项等会很好。这就是我正在努力解决的问题。
这是我的代码部分(在我的 EditActivity 中):
resultBundle.putString("MessageString", message);
resultBundle.putString("ContentString", AlertContents);
resultBundle.putString("BackgroundColour", BackgroundCol);
resultBundle.putString("TextColour", TextCol);
resultBundle.putStringArrayList("myArray", theList);
resultIntent.putExtras(resultBundle);
//Take above values and replace any %Variables with the Tassker values in the host
if ( TaskerPlugin.Setting.hostSupportsOnFireVariableReplacement( this ) )
TaskerPlugin.Setting.setVariableReplaceKeys( resultBundle, new String [] { "MessageString" } );
TaskerPlugin.Setting.setVariableReplaceKeys( resultBundle, new String [] { "ContentString" } );
TaskerPlugin.Setting.setVariableReplaceKeys( resultBundle, new String [] { "BackgroundColour" } );
TaskerPlugin.Setting.setVariableReplaceKeys( resultBundle, new String [] { "TextColour" } );
TaskerPlugin.Setting.setVariableReplaceKeys( resultBundle, new String [] { "myArray " } );
resultIntent.putExtras(resultBundle);
这基本上是将我的值设置为一个包,然后根据我的理解,“setVriableReplaceKeys”函数会遍历我在包中指定的每个 keypai,以用当前值替换任何 taskerr 变量(例如 %BATT)存储在主机中。以下不起作用,我只看到写出的变量名没有任何值,所以如果我将 %BATT 用于测试它,我会在列表中看到 %BATT 而不是实际的电池百分比。
任何帮助将不胜感激。我已经玩了很久了。
【问题讨论】:
标签: android automation tasker