试图将 AutofillId 类型的对象传递给 Dataset.Builder

问题描述

我正在尝试使用 DataSet.Builder 方法为我的填充响应创建自动填充服务。我想不出将 AutofillId 传递给该数据集的方法

    val context = request.fillContexts.last()
    //creates a parser to parse the view
    val parser = AssistStructureParser(context.structure)// Add a dataset to the response
    val fillResponse: FillResponse = FillResponse.Builder()
            .addDataset(Dataset.Builder()
                    .setValue(
                            //Pass some autofillID signifying the UN field,AutofillId(parser.fieldIds[AutofillInputType.UserName].hashCode()),AutofillValue.forText("username")
                            //usernamePresentation
                    )
                    .setValue(
                            //Pass some autofillID signifying the PW field,AutofillId(parser.fieldIds[AutofillInputType.Password].hashCode()),AutofillValue.forText("password")
                            //passWordPresentation
                    )
                    .build())
            .build()

就像现在一样,我很受打击

e: autofill_service\FlutterMyAutofillService.kt: (239,33): Cannot access '<init>': it is public/*package*/ in 'AutofillId'
e: autofill_service\FlutterMyAutofillService.kt: (245,33): Cannot access '<init>': it is public/*package*/ in 'AutofillId'

我只需要弄清楚如何传递 autofillId 对象。

供参考,

var usernamefields = parser.fieldIds[AutofillInputType.UserName]
Log.d("USERNAME FIELDS","${usernamefields}")

[MatchedField(heuristic=AutofillHeuristic(weight=700,predicate=Function2<android.app.assist.AssistStructure$ViewNode,android.app.assist.AssistStructure$ViewNode,java.lang.Boolean>),autofillId=1073741824@1381197270),MatchedField(heuristic=Autofi
llHeuristic(weight=700,java.lang.B
oolean>),autofillId=1073741828@1381197270)]

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)