【问题标题】:How to use Uri.parse in android如何在 android 中使用 Uri.parse
【发布时间】:2013-09-13 20:00:46
【问题描述】:

您好,我正在测试网络 url 的加密和解密,并尝试开发网络浏览器的意图。

String decrypted = DecodeAES.decrypt(AESkey, encrypted);
decryptedValue.setText(decrypted);

在这里我想检索“decryptedValue”并放在 Uri.parse 实际上这里的“decryptedValue”包含一些要在浏览器中打开的网站。

Intent browserIntent = new Intent(Intent.ACTION_VIEW,Uri.parse("http://www.google.com"));
startActivity(browserIntent);

请告诉我如何使用 Uri.parse 以及使用什么。

提前致谢。

【问题讨论】:

  • uri需要协议,本例为google.com,http为协议。

标签: android parsing


【解决方案1】:

改变-

Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("www.google.com"));

到 -

Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));

【讨论】:

  • 问题是我想将文本解析为字符串。这意味着这里 'decryptValue'=google.com Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse('decryptValue'));
  • 所以可以-Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://" + decryptValue));
猜你喜欢
  • 1970-01-01
  • 2011-12-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-12-27
  • 2017-01-12
  • 1970-01-01
相关资源
最近更新 更多