有人可以举一个简单的例子,说明 native 应用程序将字符串传递到网站的 java 代码吗?
例如:当字符串的值为 HelloEveryone
时,文本 Helloeveryone
应粘贴到 Google 搜索字段中。
最佳答案
对于最简单的使用,您可以尝试:
public static void browseURL(Activity activity, String url)
{
try
{
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
activity.startActivity(intent);
}
catch (Exception e)
{
message(activity, "Sorry, failed to view the desired page.");
}
}
然后调用:
browseURL("http://www.google.com/search?q=Hello+World")
关于java - native 应用程序将字符串传递到网站的简单示例?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6972753/