使用内容提供商调用Web浏览器

时间:2014-03-14 12:57:30

标签: android

我是一名混合应用程序开发人员,希望开发一款Android应用程序。我是新的机器人。我想在Web浏览器中打开给定的链接。我将在javascript的混合应用程序中执行以下操作

<a href="www.google.co.in">www.google.co.in</a>

我需要在android中实现它。我该怎么做?

3 个答案:

答案 0 :(得分:1)

你应该使用意图

 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("www.google.co.in"));
 startActivity(intent);

意图:http://developer.android.com/reference/android/content/Intent.html

@giacomoni的这个链接也很棒(来自android教程):http://developer.android.com/guide/components/intents-filters.html

我现在正打电话,所以我无法提供链接

答案 1 :(得分:0)

在您的Java代码中,负责按钮(或任何其他元素)的点击事件:

Intent intent = new Intent(Intent.ACTION_VIEW).setData(Uri.parse("www.google.co.in"));      
startActivity(intent); 

答案 2 :(得分:0)

以下是实施上述的鳕鱼。在任何函数中添加以下代码。

Intent i = new
Intent(android.content.Intent.ACTION_VIEW,
Uri.parse(“http://www.amazon.com”));
startActivity(i);