gpt4 book ai didi

java - 如何从android中的webview获取url中存在的值?

转载 作者:行者123 更新时间:2023-11-29 20:49:20 26 4
gpt4 key购买 nike

我有一个 url,其中在 webview 中有 id(例如订单 id、产品 id 等)。如何获取这些 ID 并将它们放入字符串中?比方说,网址是

www.xyz.com/buy/thankyou/handlers/display.html?ie=UTF8&asins=B00F0G8K&orderId=404-35644-70307&purchaseId=404-2849-9658

我需要为 &asins&orderid&purchase_id 提供的值并将它们传递到另一个 url。我怎样才能得到它们?所有这一切都发生在 WebView 中。

最佳答案

WebView 获取 URL,将其解析为 Uri 并从中获取单独的查询参数。

示例:

Uri uri=Uri.parse(myWebView.getUrl());
String orderId = uri.getQueryParameter("orderid");

关于java - 如何从android中的webview获取url中存在的值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29576607/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com