【问题标题】:How to translate android intent to flutter如何将android意图翻译为颤振
【发布时间】:2022-01-20 01:22:11
【问题描述】:

我正在尝试调用具有某些参数的 android 应用程序,有人可以通过尝试将以下代码转换为颤振来帮助我吗,我正在使用 Android Intent 颤振包但运气不佳。

下面是我试图从 Native android / Groovy 转换为 Flutter 的代码

val launchIntent = Intent()
launchIntent.action = "CenDroid"
launchIntent.putExtra("Operation", "Sale")
// Get the time
val millisecond: Long = java.lang.System.currentTimeMillis()
val timeString = milliseconds.toString()
launchIntent.putExtra("Time", timeString)
launchIntent.putExtra("Caller", "Caller Name")
// InvocationKey is Sha512 of Sha256 of Sha1 of whatever is sent in the Time field.
var hashed = HashUtils.sha1(timeString)
hashed = HashUtils.sha256(hashed)
hashed = HashUtils.sha512(hashed)
launchIntent.putExtra("InvocationKey", hashed)
launchIntent.putExtra("Amount", 100.0F)
launchIntent.flags = Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
startActivityForResult(launchIntent, 1)

任何帮助都会有很大帮助

【问题讨论】:

    标签: android flutter groovy


    【解决方案1】:

    Flutter 使用 this 将一个页面导航到另一个页面

    Navigator.push(
        context,
        MaterialPageRoute(builder: (context) =>SecondRoute()),
      );
    

    查看参数从一页传递到另一页

    Passing data

    【讨论】:

    • 感谢您的回复,但上面的代码是打开一个应用程序并传递到另一个页面
    • 在android中,putExtra方法会在两个activity之间传递参数。这个概念通过传递数据在颤振中使用,提供链接
    猜你喜欢
    • 1970-01-01
    • 2020-12-29
    • 1970-01-01
    • 1970-01-01
    • 2020-02-08
    • 1970-01-01
    • 2022-01-18
    • 1970-01-01
    • 2018-10-16
    相关资源
    最近更新 更多